Skip to content

Instantly share code, notes, and snippets.

@Nyarll
Created July 27, 2018 06:45
Show Gist options
  • Save Nyarll/b072204ae52086ba8ccaa6a1b321e1ee to your computer and use it in GitHub Desktop.
Save Nyarll/b072204ae52086ba8ccaa6a1b321e1ee to your computer and use it in GitHub Desktop.
HighScoceFileStreaming.cpp
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