Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//copy.c //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

image text in transcribed

//copy.c

//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 (0); } int main(int argc, char * argv[]) { copyfile(argv[1], argv[2]); }
COMP-2560 System Programing Dr. Abedalrhman Alkhateeb Lab3.c This lab will help you to do assignment2 It will be compiled/run like: >>gcc lab3.c-o lab3 Mab3 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("//,' ").E.G. When the code finds " ". The message will be printed as like: printf("Fnd line has been found '); if you the codes finds"//", then it will print: printf("The beginning of the comment // has been foundin"); source.c can be any programming with comments: // This is a program /******** The program is created by Abed Alkhateeb It is jus an example: Created Date Jan 29

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions

Question

3. Have the group identify common themes.

Answered: 1 week ago