Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int argc, char *argv[])
- {
- char player[47];
- int score=21;
- FILE *f = fopen("data.txt", "w");
- printf("What's your name, stranger?\n");
- scanf ("%s", player);
- if(f) //Did the file get opened O.K. and created?
- {
- printf("Writing info, to file... Alright! \n (Press any key to quit...)");
- fprintf(f,"%s\n%i\n", player, score);
- } else printf("See the system administrator, you dolt!");
- fclose(f);
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment