Question: Then here is the example code. Using mycopy.c(attached with the assignment) you will create a similar c program named copywnc.c (copy with no comments) that

Then here is the example code. Using mycopy.c(attached with the assignment) youwill create a similar c program named copywnc.c (copy with no comments)Then here is the example code.

that will copy the C file with no comments. It will remove

Using mycopy.c(attached with the assignment) you will create a similar c program named copywnc.c (copy with no comments) that will copy the C file with no comments. It will remove any C file comment that follow // or in between of /* and */ For example, if we have file a.c with the following content: // This is a C program /******** The program is created by Abed Alkhateeb It is jus an example: Created Date Jan 29 ********** **/ #include int main() { printf("Hello World"); //print hello world message return 0; } if you run:./copywnc.c a.cb.c then b.c will have the following content: #include int main() { printf("Hello World"); return 0; } //copy file f1 to f2 using standard I/O #include int copy file(const char *f1, const char *f2) { FILE *inf, *outf; int c; if ((inf = fopen(f1,"r")) == NULL) { return (-1); } if ((outf = fopen(f2, "w")) == NULL) { fclose(inf); return (-2); } while ((c=getc(inf)) != EOF) { putc(c, outf); } fclose(inf); fclose(outf); return (0); } int main(int argc, char * argv[]) { copyfile(argv[1], argv[2]); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!