Saturday, 5 November 2016

file handling read and write in text

#include<stdio.h>
#include<conio.h>
int main()
{
FILE *f;
char c;
f=fopen("data.txt","w");
while(c!='.') //it will terminate the loop when u enter the full stop(.)
            
{
c=getche();
fputc(c,f);

}
fclose(f);
printf("\ncontent of field are :");
f=fopen("data.txt","r");
while(!feof(f))
{
printf("%c",fgetc(f));
}
}
                            OUTPUT


2 comments: