Question: Q 4 . Write a program in C to simulate the output redirection using the dup family of system calls ( dup , dup 2
Q Write a program in C to simulate the output redirection using the dup family of system callsdup dup dup
points
This program consists of parts :
Part : Simple Output Redirection
Implement a function
That opens a file for writing From user
Uses dup dup to redirect stdout to file
Prints some random text to the redirected stdout
Verify that the data is written in the file.
qp outputptxt output.txt must contain some random text
Part : Interactive Simulation
Simulate a simple shelllike command that redirects the stdout and stderr of any internal command into a file. Eg :
qpls l outputptxt output.txt must contain the output of Is I
Deliverables:
Qc containing the implementation for both parts We should be able to test the implementation of both parts
Makefile to compile the program
outputptxt and outputptxt containing the output from both parts.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
