Hello!
I have got the following sample:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream file;
cout << file << endl; // 0xbffff3e4
file.open("no such file");
cout << file << endl; // 0
cout << (file == NULL) << endl; // 1
cout << file.fail() << endl; // 1
}
If the file is NULL
, how is it possible to call the fail
member function? I am not very familiar with C++, is this normal behaviour? What am I getting wrong here?