C program to write in text file


C program to write in text file

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
clrscr();
fp=fopen("abc.txt","w");
fputs("This is Tutorial",fp);
if(fp==NULL)
{
printf("file can't be created");
}
else
{
printf("contents written in file");
}
getch();
}

Comments