i want to copy contents in one file in to another file.
fPout=fopen("parse.txt","r")
fPin=fopen("dpl.txt","w")
do
{
a = fgetc(fPParse);
fputc(a,fPOut);
}
while(a!=EOF);
i'm using this method but it shows error while compiling like multiple declaration,type mismatch etc. Also i've tried fread function but it doesn't work please help.....
Manoj BhoirPosted Jun 10, 2015, 4:55 AM
#include
void main() {
FILE *fp1, *fp2;
char a;
clrscr();
fp1 = fopen("test.txt", "r");
if (fp1 == NULL) {
puts("cannot open this file");
exit(1);
}
fp2 = fopen("test1.txt", "w");
if (fp2 == NULL) {
puts("Not able to open this file");
fclose(fp1);
exit(1);
}
do {
a = fgetc(fp1);
fputc(a, fp2);
} while (a != EOF);
fcloseall();
getch();
}