Here i am posting a program which writes the data which you have entered into ganesh through console and copies that data particular data into another file .
#include<stdio.h>
void main()
{
FILE *f1, *f2;
char ch;
f1 = fopen("Ganesh.txt","w+");
f2 = fopen("Simple.txt","w");
printf("Enter data into ganesh file (ctrl+z to stop) : ");
while((ch=getchar())!=EOF)
putc(ch, f1);
rewind(f1);
while((ch=getc(f1))!=EOF)
putc(ch, f2);
printf("\n\t\tData copied from ganesh to simple file");
fclose(f1);
fclose(f2);
getch();
}
0 comments:
Post a Comment