Signaling an error in file streams in C++
<p>I have got the following sample:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;
int main()
{
    ifstream file;
    cout &lt;&lt; file &lt;&lt; endl;           // 0xbffff3e4
    file.open("no such file");
    cout &lt;&lt; file &lt;&lt; endl;           // 0
    cout &lt;&lt; (file == NULL) &lt;&lt; endl; // 1
    cout &lt;&lt; file.fail() &lt;&lt; endl;    // 1
}
</code></pre>

<p>If the file is <code>NULL</code>, how is it possible to call the <code>fail</code> member function? I am not very familiar with C++, is this normal behaviour? What am I getting wrong here?</p>
