8/* Program to append the contents of one file at the end of another file. */


#include<stdio.h>
#include<ctype.h>
void main()
{
FILE *p,*q;
char s[10],d[10],ch;
clrscr();
printf(“\nEnter The Source FileName :: “);
gets(s);
printf(“\nEnter The Target FileName :: “);
gets(d);
p=fopen(s,”r”);
if(p==NULL)
{
printf(“\nFile Not Found”);
exit(1);
}
q=fopen(d , “a”);
if(q==NULL)
{
printf(“\nFile Creating Error”);
exit(1);
}
while( (ch=getc(p))!=EOF)
{
putc(ch,q);
}
printf(“\n\nThe Convertion Is Successfull! \n”);
fclose(p);
fclose(q);
printf(“\n\nThe Content Of File ‘%s’ Is :: \n”,s);
p=fopen(s,”r”);
while( (ch=getc(p))!=EOF)
printf(“%c”,ch);
fclose(p);
printf(“\n\nThe Content Of File ‘%s’ Is :: \n”,d);
q=fopen(d,”r”);
while( (ch=getc(q))!=EOF)
printf(“%c”,ch);
fclose(q);
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s