Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the copy of the code to follow. It will be compiled/run like: >>gcc lab3.c-o lab3 /lab3.c source.c destination.c Write C program lab.c based

image text in transcribedimage text in transcribed

This is the copy of the code to follow.

It will be compiled/run like: >>gcc lab3.c-o lab3 /lab3.c source.c destination.c Write C program lab.c based on the attached program mycopy.c. The code will still copy from source.c to destination.c. but will also print the followings when they are found (Il, ,"\*,"*\). E.g. When the code finds , The message will be printed as like: fprintf("End line has been found "); if you the codes finds 'll", then it will print: fprintf(The beginning of the comment has been found "); source.c can be any C programming with comments: // 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; } //copy file f1 to f2 using standard I/O #include int copyfile(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 (); } int main(int argc, char * argv[]) { copyfile(argv[1], argv[2]); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions