How do I check if istream is at the end of the file
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6283632/how-to-know-if-the-next-character-is-eof-in-c">How to know if the next character is EOF in C++</a>  </p>
</blockquote>



<p>I want to find out whether or not some istream has reached to the end of file.</p>

<p>Something like</p>

<pre><code>if (my_istream.peek() == EOF) {...}
</code></pre>

<p>The documentation advice to use <code>traits::eof()</code>. How do I do that? I don't understand.</p>
