Hi, i am creating a little c++ rpg game and now i have trouble with saving and loading data.
Saving Game:
For saving game, i just have to output all the info of my hero to a txt file. To do that, i use something like this:
ifstream myFile;
ofstream outfile;
Code:
outfile.open("SaveLoadgame.txt");
...
...
outfile<<name<<endl<<stamina<<endl<<hp<<endl;
Loading Game:
For loading game i read into the same txt file(which i think i cannot do that)
Code:
myFile.open("SaveLoadgame.txt");
...
...
myFile>>name;
myFile>>stamina;
myFile>>hp;
...
But the problem is after saving the game and close it, then i restart it , my txt file automatically become blank. Therefore there are nothing to load....
I think i cannot use the same txt file name.
Is that another method to do that?