Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- main()
- {
- FILE *fp;char filename[20];
- char ch;
- printf("Enter file name : ");
- gets(filename);
- fp = fopen(filename, "w");
- if (fp == NULL)
- {
- printf("Could not open file ");
- }
- printf("Enter content to be written in file : ");
- while((ch=getchar())!='\n')
- {
- fputc(ch,fp);
- }
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement