Question: 3. Copy a File Using Pipes: Implement a command (lastnameCP) that copies one file (source) to another (destination) using pipes. This is a lab in
3. Copy a File Using Pipes: Implement a command (lastnameCP) that copies one file (source) to another (destination) using pipes. This is a lab in C
Hint: A possible solution:
- Parent process creates a pipe then forks a child process:
The parent process opens and reads the input file, that was passed as an argument, and writes the data to the upstream end of a pipe.
The child process opens the output file, reads data from the pipe and writes it to the output file.
- When done, the parent process closes the upstream and the child closes downstream.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
