EmbLogic's Blog

This is a program to copy the contents of one file into another using fputc.

@This is a program to copy the contents of one file into another using fputc.
@

1.1
log
@Initial revision
@
text
@#include<stdio.h>
int main()
{
FILE *fp1,*fp2;
char a;
fp1=fopen(“file2″,”r”);
if(fp1==NULL)
{
puts(“cannot open this file”);
goto OUT;
}
fp2=fopen(“file1″,”w”);
if(fp1==NULL)
{
puts(“cannot open this file”);
goto OUT;
}
do
{
a=fgetc(fp1);
fputc(a,fp2);
}
while(a!=EOF);

return 0;
OUT:
return -1;
}
@

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>