Saturday, 5 December 2015

Copy the Data or Content of One file to Another file Using C Program.


Copy the Data or Content of One file to Another file Using C Program


Program Code for Copy File

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
FILE *fp2;
char c;
fp=fopen("Myfile.txt","r");
fp2=fopen("MyNewFile.txt","w");
c=getc(fp);
while(c!=EOF)
{
fprintf(fp2,"%c",c);
c=getc(fp);
}
fclose(fp);
}

No comments:

Post a Comment