C program to open a file and write some text and close its.

source code


#include<stdio.h>
int main()
{
FILE *fp;
char ch;
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();
return 0;
}

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.