C Program to accept data and store the given data into file print the data

CWC
0 Min Read

C Program to accept data and store the given data into file print the data

#include<conio.h>
#include<stdio.h>
main( )
{
FILE *fp;
char c;
fp=fopen(“data.dat”,”w”);
clrscr();
printf(“enter text”);
while(1)
{c
=getchar( );
if(c==eof( ))
break;
putc(c);
}f
close(fp);
fp=fopen(“data.dat”,”r”);
while(1)
{c
=getc(fp);
if(c==eof( ))
break;
putchar(c);
}
getch( );
fclose(fp);
}

 

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version