Monday, November 21, 2011

How to copy data from one file to another file using C program


In this post i am posting a simple c program to copy the data from one file to another file .

#include<stdio.h>
void main()
{
FILE *f1, *f2;
char ch;
clrscr();
f1 = fopen("priya.txt","r");
f2 = fopen("jagan.txt", "w");

while((ch=getc(f1))!=EOF)
putc(ch, f2);

printf("\n\tData has been copied");

fclose(f1);
fclose(f2);

getch();
}

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Vamshi krishnam raju | Bloggerized by Vamshi krishnam raju - Vamshi krishnam raju | Vamshi krishnam raju