Mega Code Archive
The use of both checking if the ifstream object used to call the open function is NULL and whether the ifstream objects fail member f
#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;
}