my tutor ask me to write C program on File processing. As i'm weak on programming , i do not know where to start n how to do it. Can anybody help me cos need to hand up in 4 days time.
The question as below:
Write a c program, mcopy, to copy a list of examination marks from a source text file to a destination text file. The file names are given as command line arguments. The copy contains only passing mark,i.e. marks that r less 50 r not copied. The copy process terminates upon reading the end of file condition on the source file. For example, the source list (80,45,50,22,99) should produce the destination list(80,50,99).
You should have only a main program that has the following:
a: A check for command line arguments to ensure that the source n destination files r specified. If not, the error message, "Usage: mcopy sourceFile destinationFile", should be printed n the program exits.
b: The source file must exist while the destination file is created. If either or both cannot be done, the program exits.
c: A loop to read every mark in the source file and filters pff failures.
d: Any other code for successful processing of the marks.
Assume that the list of numbers is in ASCII text, with one mark on a line,e.g.
Can use FILE *open(const char *filename, const char *mode);
int fclose(FILE *fp);
int fprintf(FILE *fp, const char *format,....);
int fscanf(FILE *fp, const char * format,....);
Pls help me as i'm idiot in programming.