Testing if file is there or not

Started by
2 comments, last by Zahlman 16 years, 9 months ago
I'm converting my old code to be compilable by DevC++, and the one thing which is not working is the ifstreamfail() command as follows: ifstream GameFile("myGame.sav"); // *.sav is standard text file if(GameFile.fail()) { ... create new character ... } else { ... start game with current character ... } any suggestions?
BladeStoneOwner, WolfCrown.com
Advertisement
Try this:
	std::fstream str("myGame.sav");	if (str)           // file is there	else {          // no file        }


This is what I useualy do, and it always worked for me.
That worked like magic! :)
BladeStoneOwner, WolfCrown.com
Namespaces.

This topic is closed to new replies.

Advertisement