Completely Solved C, C++ Programs Assignment.




C Program to copy contents of one file into another.

Filed Under:

Problem 69. C Program to copy contents of one file into
another.
#include<stdio.h>
#include<conio.h>
main( )
{
FILE *fp1,*fp2;
char ch;
fp1=fopen(“text1”,”w”);
printf(‘enter the text”);
while((ch=getchar( ))!=EOF)
putc(ch,fp1);
fclose(fp1);
fp1=fopen(“text1”,”r”);
fp2=fopen(“text2”,”w”);
while((ch=getc(fp1))!=EOF)
putc(ch,fp2);
fclose(fp2);
getch( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments