Mega Code Archive
Checking if open function is NULL and ifstream objects fail
#include
#include
using namespace std;
int main ()
{
ifstream infile;
infile.open("students.dat");
cout << "(infile) = " << infile << endl;
cout << "(infile.fail()) = " << infile.fail() << endl;
return 0;
}