Question: My question is listed the below please any help this assignment ; There is a skeleton code: copy_file_01.c #include #include int main(int argc, char* argv[])

My question is listed the below please any help this assignment ;

There is a skeleton code: copy_file_01.c

#include #include

int main(int argc, char* argv[]) { char ch ; FILE *source , *target;

if(argc != 3){ printf ("Usage: copy file1 file2"); exit(EXIT_FAILURE); }

source = fopen(argv[1], "r");

if (source == NULL) { printf("Press any key to exit... "); exit(EXIT_FAILURE); }

target = fopen(argv[2], "w");

if (target == NULL) { fclose(source); printf("Press any key to exit... "); exit(EXIT_FAILURE); }

while ((ch = fgetc(source)) != EOF) fputc(ch, target);

printf("File copied successfully. ");

fclose(source); fclose(target);

return 0; }

hw1 using system calls

The following program copies input file *argc[1] to output file *argc[2]. For file access the following C library functions are used:

FILE * fopen ( const char * filename, const char * mode );

int fclose ( FILE * stream ); int fgetc ( FILE * stream ); int fputc ( int character, FILE * stream ); re-write copy_file_01.c program using linux system calls replacing the functions which are listed above. 
this web page is useful: 
https://www.geeksforgeeks.org/input-output-system-calls-c-create-open-close-read-write/

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!