ifstream how to determine why file does not open?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/839644/get-stdfstream-failure-error-messages-and-or-exceptions">Get std::fstream failure error messages and/or exceptions</a>  </p>
</blockquote>



<p>I am using <code>ifstream</code> and I need to make opening of file very robust. </p>

<pre><code>std::ifstream myfilestream(fileName);

if (!(myfilestream.is_open())){  // if not open how do I determine cause?

}
</code></pre>

<p><a href="http://www.cplusplus.com/reference/iostream/ifstream/" rel="nofollow">http://www.cplusplus.com/reference/iostream/ifstream/</a></p>

<p>Thanks</p>
