Question: Can someone please help with the below assignment? You will write a program named split.c which splits a file specifiled from the command line argument
Can someone please help with the below assignment?
You will write a program named split.c which splits a file specifiled from the command line argument into multiple files of 10,000 bytes. Add .0, .1, .2, .3 ... to the original filename as new files' name. You can generate filenames using sprintf(). For example:char *filename = argv[1];
char name[256];
int i = 0;
sprintf(name,"%s.%d", filename,i);
If split encounters any kind of error, it must exit immediately and print out a message that state the reason for failure. The given code will read 10,000 bytes from file foo and write 10,000 bytes to file foo.1
System Calls
You will need to use the following systems calls: open , read, write, close, exit along with other C functions: printf, strerror to implement this assigment.
Thank you! :)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
