/ Published in: C++
Expand |
Embed | Plain Text
bool FileExists(string filename) { ifstream file; file.open(filename.c_str()); //note that the filename must be a c-string. A string gives an error // Check if the file exists if (file.is_open() == true) { //the 'is_open()' does all the work file.close(); return true; } return false; }
You need to login to post a comment.
