In this program, we are going to share C program to copy one file into another file using C programming language. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to copy one file into another file with the output.
We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.
void main(int argc,char **argv)
FILE *fp1, *fp2;
if ((fp1 = fopen(argv,"r")) == NULL)
printf("\nFile cannot be opened");
printf("\nFile opened for copy...\n ");
fp2 = fopen(argv, "w");
fseek(fp1, 0L, SEEK_END);
pos = ftell(fp1);
fseek(fp1, 0L, SEEK_SET);
ch = fgetc(fp1);
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.