#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
FILE *f,*f1;
char c;
clrscr();
f=fopen("balaram.txt","w");
if (f==NULL)
{
printf("Cannot open file");
exit(1);
}
printf("write data and to stop press '.':");
while(c!='.')
{
c=getche();
fputc(c,f);
}
fclose(f);
printf("\n contents read:");
f1=fopen("balaram.txt","r");
while(!feof(f1))
printf("%c",getc(f1));
}
No comments:
Post a Comment