Given the following simple program explain what the program
Given the following simple program, explain what the program does. Give a sample command line usage for the program./* * sample test program - testProgram.c */#include int main (int argc, char *argv[]) {FILE *fptr1, *fptr2; int c; if (argc != 3) printf(\"wrong usage \ \"); else if ((fptr1 = fopen(argv[1], \"r\")) != NULL) if ((fptr2 = fopen(argv[2], \"wr\")) != NULL) {fseek(fptr2, 0, SEEK_END); while ((c = fgetc (fptr1)) != EOF) fputc(c, fptr2);} else 20 printf(\"Can\'t open file \\\"%s\\\"\"\ \"\"
Solution
the above program will use the command line arguments.
sample run will be like
/a.out fil1.txt file2.txt
if the above command line not followed are argumentsa not equals to 3(.out and files) the program will terminate
if the files are opend with their mode then it copies the file1 data and writes to the file2 else it will display file opening errors
