Can anyone help me...i have a file modt.txt and i want to save the content in modt2.txt but it seems my code is not working. Moreover,
if i have the content of the 1st file Have a nice day. i want to save it to the 2nd file without double space it should be Have a nice day. I have this as my code:
#include <stdio.h>
void copyf(char *fname1, char *fname2){
FILE *fp1,*fp2;
int x;
if (((fp1=fopen(fname1,"r"))==NULL)||((fp2=fopen(fname2,"w"))==NULL))
{
printf("error:unable to open the filed\n");
exit(1);
}
while((x=getc(fp1))!=EOF)
putc(x,fp2);
fclose(fp1);
fclose(fp1);
}
main(){
copyf("modt.txt","modt2.txt");
}