Program toward Write String in a FiIe in C language
#include "stdio.h"#include "conio.h"
#include "iostream"
#include "fstream"
using namespace std;
void main()
{
FILE *p;
char str[70];
if((p=fopen("string.txt","w"))==NULL)
{
printf("\nUnable toward open file string.txt");
exit(1);
}
else
printf("\nEnter a set regarding strings,Press just enter key toward finish\n: ");
while(strlen(gets(str))>0)
{
fputs(str,p);
fputs("\n",p);
}
fclose(p);
getch();
}