How do i load from files in the documents folder on any computer?
I am making a game that have a highscore.txt file.
So far, how i load and save the highscore.txt file is kinda this way.
[source lang="cpp"]int score = 0;int highscore = 0;std::ifstream inputfile;inputfile.open("highscore.txt");inputfile >> highscore;inputfile.close();/*Play the game (gameloop)*/if(score > highscore){ std::ofstream outputfile("highscore.txt"); outputfile << score; outputfile.close();}[/source]
But the problem is when i make an installer for my game, then i have to put the highscore.txt file in another folder (e.g my documents folder) than my original folder where all the images, dlls are. Otherwise i cant save my new highscore (only load) because the c: drive is protected and windows wont allow to edit it.
Ive tried to write something like this:
[source lang="cpp"]inputfile.open("C:\\Users\\Danny\\Documents\\highscore.txt");[/source]
It works, but "Danny" is my name and is of course not the same name as other peoples computers.
So what kind of code should i use/write to make it able to load and save in the highscore.txt file on the documentsfolder on any computer?
If u can help me (and if its gonna be a hard task), please, cut it in paper for me (post the code
Thanks alot!!!






