C program code | file handling with fopen using while loop
#include<stdio.h>
void main()
{
FILE *f1,*f2,*f3;
char c;
clrscr();
printf("input text");
f1=fopen("cmb.txt","w");
f2=fopen("cmb01.txt","w");
f3=fopen("cmb02.txt","a");
while((c=getchar()) != EOF)
putc(c,f1);
f1=fopen("cmb.txt","r");
while((c=getc(f1)) !=EOF)
printf("%c",c);
fclose(f1);
while((c=getchar()) != EOF)
putc(c,f2);
fclose(f2);
f2=fopen("cmb01.txt","r");
while((c=getc(f2)) !=EOF)
printf("%c",c);
fclose(f1);
fclose(f2);
}
programming example for C program code | file handling with fopen using while loop
#include<stdio.h>
void main()
{
FILE *f1,*f2,*f3;
char c;
clrscr();
printf("input text");
f1=fopen("cmb.txt","w");
f2=fopen("cmb01.txt","w");
f3=fopen("cmb02.txt","a");
while((c=getchar()) != EOF)
putc(c,f1);
f1=fopen("cmb.txt","r");
while((c=getc(f1)) !=EOF)
printf("%c",c);
fclose(f1);
while((c=getchar()) != EOF)
putc(c,f2);
fclose(f2);
f2=fopen("cmb01.txt","r");
while((c=getc(f2)) !=EOF)
printf("%c",c);
fclose(f1);
fclose(f2);
}
programming example for C program code | file handling with fopen using while loop
0 comments: