Pipes
Description
You will write a function similar to the exec
family of functions and a
driver program to test the function.
General Specifications
The default make target should create the
test-driver
executable.For reusability, the function should be declared in its own header file and defined in its own implementation file.
Function Specifications
The function you write should behave like the exec family of functions, which are essentially used to run a separate program which we will call command here:
- The standard out of the command is returned in a buffer.
- The standard error of the command is returned in a buffer.
- The exit status of the command is returned.
You get to decide what the API looks like. Include a README file in your submission that documents your design decisions.
Driver Specifications
The name of the compiled program must be
test-driver
.The input to the program must be the command to run in double quotes. For example to run the
ls
program with the-l
flag, the program would be executed as./test-driver "ls -l"
The behavior of the
test-driver
is call the function you created. If the status code indicates that the command was successful, then print the standard out buffer to the screen. Otherwise, print the standard error to the screen.
Turning in the Assignment
For this assignment, you must turn in a zip file of a directory named
project2
containing the appropriate files. Include a README file that
discusses the design decisions that you made.
Submit the zip file to the appropriate folder on D2L.