int main()
{
FILE *fp;
char c;
printf("FILE HANDLING \n");
// Create and write the file content
fp=fopen("demo.txt","w");
// Writing Operation
while((c=getchar())!=EOF)
{
putc(c,fp);
}
//close the file using fclose()
fclose(fp);
printf("Data Entered : \n");
//reading data from file
fp=fopen("demo.txt","r");
while((c=getc(fp))!=EOF)
{
printf("%c",c);
}
//close the file
fclose(fp);
return 0;
}