Archived

This topic is now archived and is closed to further replies.

RegularKid

HELP...

Recommended Posts


fstream file;
file.open(filename, ios::in|ios::nocreate);
if(file.fail())
{
// we either couldn''t open the file
// or couldn''t create it
return -1;
}
// use file here

You could also use file.good() to check if the open was successful (which means the file could be opened and thus exists) and close() it right after that.



I wanna work for Microsoft!

Share this post


Link to post
Share on other sites