Wednesday, April 18, 2012

CREATE A 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();
}

No comments:

Post a Comment