Program 203:
//Coming Soon...
Output:
Store both text file and program in same folder.Here I named text file as file2.txt
Before Running Program
Running the Program
After Running the program
#include<stdio.h> #include<stdlib.h> #include<string.h> main () { FILE *file; char s[100]; file=fopen("file2.txt","w"); if(file==NULL) { printf("File Not Found\n"); exit(0); } else { printf("Enter lines to write in file\n"); while(strlen(gets(s))>0) { fputs(s,file); fputs("\n",file); } } fclose(file); }Explanation:
//Coming Soon...
Output:
Store both text file and program in same folder.Here I named text file as file2.txt
Before Running Program
Running the Program
After Running the program
No comments:
Post a Comment