answersLogoWhite

0


Best Answer

#include

#include

void main()

{

FILE *fp1,*fp2;

char ch,fname1[20],fname2[20];

printf("\n enter sourse file name");

gets(fname1);

printf("\n enter sourse file name");

gets(fname2);

fp1=fopen(fname1,"r");

fp2=fopen(fname2,"a");

if(fp1==NULLfp2==NULL)

{

printf("unable to open");

exit(0);

}

do

{

ch=fgetc(fp1);

fputc(ch,fp2);

}

while(ch!=EOF);

fcloseall();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

#include
#include
void main()
{
char fname1[20],fname2[20],c;
FILE *fp1,*fp2;
printf("\nEnter file 1 name :");
scanf("%s",fname1);
printf("\nEnter file 2 name :");
scanf("%s",fname2);
fp1=fopen(fname1,"r");
fp2=fopen(fname2,"a");
if(fp1==NULL fp2==NULL)
{
printf("\nSome error.");
return;
}
while((c=fgetc(fp1))!=EOF)
{
fputc(c,fp2);
}
fcloseall();
printf("\nFile Appended Done.");
}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: 7 Write a program to append one file at the end of another?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What abilities does the NTFS write permission grant?

Write to the file, append to the file, and read or change its attributes.


What is difference between append mode and write mode?

Write mode over writes the existing file and if not present creates a new one. Append mode never over writes the existing file. Append mode opens the file and sets the file cursor to the end of the file so that any write operation can start from the very ending of that file. Hope I helped :)


What is append command in dbase?

"append" command is used to append new records to a dbf file. You can "append blank" or you can "append from" another existing database file. Conditions can be specified while appending, eg; append from <filename> for <condition> (or) append while <condition>. Append can also be done from non dbf files, such as delimited text files.


Write a c program with an append operation on an existing file?

#include<stdio.h> #include<stdlib.h> int main() { FILE *fp; char a[60],b[60]; printf("Enter the name of the file\n"); scanf("%s",a); fp=fopen(a,"a+"); printf("Enter a single line to append to the file %s :\n",a); scanf(" %[^\n]s",b); fprintf(fp,"%s",b); printf("Append Successfully to the file %s",a); fclose(fp); return 0; }


How can you read and write to files in C programming language?

We can read and write to files with the help of file commands in c programming.There are so many commands related to file for read,write,append,delete etc.


3 What is the difference between and redirection notations?

> is use to write standard output from a file. and >>is use to append standard output to the end of a file. ranjeet khune(dd)


What is hyperlink in any micro-soft program mean?

In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.In a Microsoft program a hyperlink is something that can be clicked on to bring you to another part of the file you have open, or to another file or to a web page.


Write a C program to extract a given word from a file?

program to extract a given word from a file


What type of file does the Append Mode work with?

OUTPUT AS


How you can delete the data in the file by opening it in the C programming in read or write mode?

To delete all the existing data in a file, simply open it in write mode. If you open the file in append mode, you need to overwrite the existing data to delete part or all of that data.


How can you append the output of a command to a file?

Use the append I/O redirection operator: >> An example would be: echo "Put this at the end of the file" >> aFile Which takes the output of 'echo' and puts/appends it to the end of the file aFile.


How do you open a file so that new data will be written to the end of the file's existing data?

append