Created
July 27, 2018 06:45
-
-
Save Nyarll/b072204ae52086ba8ccaa6a1b321e1ee to your computer and use it in GitHub Desktop.
HighScoceFileStreaming.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void InitResult(void) | |
{ | |
FILE *fp = NULL; | |
fopen_s(&fp, "Resources/HighScore.txt", "r"); | |
fscanf_s(fp, "%d", &high_score); | |
fclose(fp); | |
} | |
void UpdateResult(void) | |
{ | |
FILE *fp = NULL; | |
static BOOL check = FALSE; | |
if ((score > high_score)) | |
{ | |
fopen_s(&fp, "Resources/HighScore.txt", "w"); | |
fprintf(fp, "%d", score); | |
fclose(fp); | |
check = TRUE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment