samedi 22 mars 2014

C++ fstream is not working


Vote count:

-2




I am making a simple game that remembers the best score.

So,I made the file best.txt.

I have the class Game.

At the beginning of the game (in the constructor) I read the previous best using fstream.

f>>best

Then during the game I use best=max(best,score)

In the destructor I write the new best to the file.

The input works,but it always says the best is 0.

I used fstream for both reading and writing,using f("best.txt",ios::in|ios::out) in the initializing list..

Please help.....

Thanks!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire