#include<stdio.h>
main()
{
FILE *fp1, *fp2;
int ch;
fp1=fopen("student.txt","r"); /* file must be there if its in read mode*/
fp2=fopen("new.txt","w");
while((ch=fgetc(fp1))!=EOF)
{
fputc(ch,fp2);
}
printf("COPIED");
}
The above program will copy file from one file to another.