#include< conio.h >
#include< stdlib.h >
void main()
{
FILE *fs,*ft;
char ch;
clrscr();
fs = fopen("file1.txt","r");
if(fs==NULL)
{
printf("Cannot open source file ! Press key to exit.");
getch();
exit(0);
}
ft = fopen("file2.txt","w");
if(ft==NULL)
{
printf("Cannot copy file !");
fclose(fs);
getch();
exit(0);
}
while(1)
{
ch = getc(fs);
if(ch==EOF)
{
break;
}
else
putc(ch,ft);
}
printf("File copied succesfully!");
fclose(fs);
fclose(ft);
}
----------------------------------------------------------
OUT PUT:
----------------------------------------------------------
0 comments :