Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a program that asks for the user’s name and saves that
- information to disk. Call the program YOURNAME.C and have it save the
- user’s name in a file named YOURNAME.TXT. */
- #include <stdio.h>
- int main()
- {
- char name[22];
- puts("Enter your name (not more than 20 characters): ");
- fgets(name, 21, stdin);
- FILE *out;
- out = fopen("yourname.txt", "w");
- fprintf(out, "%s", name);
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement