|
CS471/571 - Operating Systems
| Displaying exercises/e1/files/copy.c
#include <stdio.h>
#include <unistd.h>
/**
* This program should accept two parameters on the command, a file to copy
* from and a file to copy to. Instead of opening and copying the files itself
* it should create a pipe between the 'from' and 'to' programs to do the
* copying. I.e. 'copy source dest' should be the same as typing in the shell:
* from source | to dest
* This program should then a) Create a pipe, b) fork a new process, c) exec
* the from and to programs in their respective processes after redirecting
* their stdin/stdout to/from the appropriate pipe descriptors.
* Hint: Remember to close both pipe descriptors in each process after
* duplicating them.
*/
int main(int argc, char *argv[])
{
return 0;
}
|