Task 1 (25 points)
following program copy.c is not efficient because it reads 1 byte at a time from
the source file and write 1 byte to the destination file. It also doesn’t have
any error checking code.
In this task, you will modify copy.c to make it more efficient (i.e. read/write 1000 bytes at a time. Additionally, you also need to add error checking code after open().
You can generate a random file to test your program using the following command:
program should work like this. (assuming nofoo doesn’t exist)
Here is copy.c:
int main(int argc, char *argv)
int input = open(source, O_RDONLY);
int output = open(destination, O_WRONLY | O_CREAT, 0600);
int r = read(input, &c, 1);