Guest User

Untitled

a guest
Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5.     char player[47];
  6.     int score=21;
  7.     FILE *f = fopen("data.txt", "w");
  8.     printf("What's your name, stranger?\n");
  9.     scanf ("%s", player);
  10.     if(f) //Did the file get opened O.K. and created?
  11.     {
  12.         printf("Writing info, to file... Alright! \n (Press any key to quit...)");
  13.         fprintf(f,"%s\n%i\n", player, score);
  14.     } else printf("See the system administrator, you dolt!");
  15.  
  16.     fclose(f);
  17.     getch();
  18.     return 0;
  19. }
Add Comment
Please, Sign In to add comment