/  C Programs   /  Program for copying file contents to another file

Program for copying file contents to another file

#include<stdio.h>
main()
{
FILE *fp1,*fp2;
char s;
fp1=fopen(“input.txt”,”r”);
fp2=fopen(“output.txt”,”w”);
while ((s=getc(fp1))!=EOF)
putc(s,fp2);
fclose(fp1);
fclose(fp2);
}

 

Program for copying file contents to another file

 

Output:

 

Program for copying file contents to another file

 

Leave a comment