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