how can i check the file which i intend to open exist or not?I must terminate the program if user enters non existing file.
how can i check the file which i intend to open exist or not?I must terminate the program if user enters non existing file.
attempt to open it. If open failes then do the error handling routine.
that's what i want to ask. Which function will i have to use.
this is c++ board, just open the file the normal way
Code:ifstream in(filename); if( !in.is_open()) { cout << "oops! can't open file" << filename << endl; return 1; }
thanks for help
Error:is_open() is not a member of ifstream
what header files did you use? (without the .h extension ??????)
Code:#include <fstream> using namespace std;