14. WRITE A C PROGRAM TO COPY ONE FILE CONTENT TO ANOTHER
FILE WITHOUT USING INBUILT FUNCTIONS
SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp1,*fp2;
char ch,fname1[20],fname2[20];
printf("\nEnter source file name :");
gets(fname1);
printf("\nEnter dest file name :");
gets(fname2);
fp1=fopen(fname1,"r");
fp2=fopen(fname2,"w");
if(fp1==NULL||fp2==NULL)
{
printf("unable to open");
exit(0);
}
do
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
while(ch!=EOF);
fcloseall();
printf("\n Files copied Successfully");
getch();
}
0 comments:
Post a Comment