Showing posts with label appends one file to another. Show all posts
Showing posts with label appends one file to another. Show all posts

Thursday, August 13, 2009

Appends one file to another

/*appends one file to another*/
#include
main()
{
char c;
FILE *fp1,*fp2;
/*assume that files,source1.c and source2.c exit already*/
fp1=fopen("source1.c","a");
fp2=fopen("source2.c","r");
c=fgetc(fp2);
while(c!=EOF)
{
fputc(c,fp1);
c=fgetc(fp2);
}
fclose(fp1);

fclose(fp2);
}