Wednesday, April 1, 2015

C program to append the contents of one file at the end of another file.

Write a ‘C’ program to append the contents of one file at the end of another file.

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp,*fq;
char ch;
clrscr();
fp=fopen("a.txt","r");
fq=fopen("b.txt","a");
if(fp==NULL)
{
printf("file does not exist");
exit(0);
}
if(fq==NULL)
{
printf("file does not exist");
exit(0);
}
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
 break;
fputc(ch,fq);
}
getch();
}

Featured posts

सौंफ के फायदे

 सौंफ त्रिदोषनाशक है, इसकी तासीर ठंडी है, पर यह जठराग्नि को मंद नहीं करती।            आंखों की रोशनी सौंफ का सेवन करके बढ़ाया जा सकता है। सौ...

Popular posts