I'm starting to learn C, and currently programming a little text-based lottery-like game. But I need a way to store the value in the end of the game, so it can be kept for the next plays. I made a simpler code below that represents what I need. Please help.
#include <stdio.h>
int main() {
//TODO get "int saved" from save.txt
printf("Value saved: %d\n", saved);
printf("Add: ");
int add;
scanf("%d", &add);
int new = saved+add;
printf("New value: %d\n", new);
//TODO save "int new" to save.txt
}
save.txt:
100