C++ Program Write a ‘C’ Program to copy the contents of one file into another file





#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fs,*ft;
char ch;
fs=fopen("a.txt","r");
if(fs==NULL)
{
printf("\nunable to open file");
}
ft=fopen("b.txt","w");
if(ft==NULL)
{
printf("cannot open target file");
}
while((ch=getc(fs))!=EOF)
{
fputc(ch,ft);
}
fclose(fs);
fclose(ft);
getch();
}