2 Aug 2019

  • August 02, 2019
  • Amitraj



/*  C Program to read data from keyword and store into a file abc.txt  */     By  Amit raj purohit
http://codevidyalay.blogspot.com

#include<stdio.h>
int main()
{

FILE *fp;
char ch;
fp=fopen("abc.txt","w");
if(fp==NULL)
{
printf("File opening error...");
return 0;
}
printf("Enter your data:\n");
while((ch=getchar())!=EOF)
{
fputc(ch,fp);
}
printf("Data stored sucessfully...");
fclose(fp);
return 0;
}


INPUT/OUTPUT:
Enter your data:
this is a sample file
^Z
Data stored sucessfully...
Content of abc.txt file:
this is a sample file
















Translate

Popular Posts