#include< conio.h >
#include< stdio.h >
#include
void main()
{
FILE *fp;
char c;
clrscr();
fp=fopen("demo.txt","w");
if(fp==NULL)
{
printf("can't open file\n");
exit(1);
}
printf("write data and to stop press =>'.'\n");
while(c!='.')
{
c=getche();
fputc(c,fp);
}
fclose(fp);
printf("\n Read Data from File =>\n");
fp=fopen("demo.txt","r");
while(!feof(fp))
printf("%c",getc(fp));
getch();
}
----------------------------------------------------------
OUT PUT:
----------------------------------------------------------
Write data and to stop press => ’.’
C Programs.
Read Data from File =>
C Programs.
0 comments :