Create File and Store Data in It
#include"stdio.h"
void main()
{
FILE *fp;
char ch;
clrscr();
fp=fopen("file.txt","w");
printf("\nEnter data to be stored in to the file:");
while((ch=getchar())!=EOF)
putc(ch,fp);
fclose(fp);
getch();
}
#include"stdio.h"
void main()
{
FILE *fp;
char ch;
clrscr();
fp=fopen("file.txt","w");
printf("\nEnter data to be stored in to the file:");
while((ch=getchar())!=EOF)
putc(ch,fp);
fclose(fp);
getch();
}
Posted by Naresh Kumar at 5:38 AM
Labels: Create file and store data
0 comments:
Post a Comment