In the pset3 Game of fifteen
What is the role of fprintf, fopen and other functions starting with f
And what is the function of
FILE *file = fopen("log.txt", "w"); fprintf(file, "%i", board[i][j]); fprintf(file, "|"); usleep(500000);
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
The code you mentioned is used to write some information to file "log.txt" (opened for "w"riting), writing a representation of the current game state to disk. That one is probably not meant to be changed in any way, and therefore can be used to test your programme's logic independently from your game representation.