C program to write a string in the file
Program:
#include<stdio.h>
void main()
{
char str[20];
FILE *out;
out=fopen("file1.txt","w");
printf("Enter string: ");
gets(str);
fputs(str,out);
fclose(out);
}
Output:
Enter string: Hello World!
Drafted on 🌏 by,
Jal
☮
peace
Comments
Post a Comment