title: Return value of ifstream.peek() when it reaches the end of the file
body: <p>I was looking at this article on Cplusplus.com, <a href="http://www.cplusplus.com/reference/iostream/istream/peek/" rel="nofollow noreferrer">http://www.cplusplus.com/reference/iostream/istream/peek/</a></p>
  
  <p>I'm still not sure what peek() returns if it reaches the end of the file.</p>
  
  <p>In my code, a part of the program is supposed to run as long as this statement is true</p>
  
  <pre><code>(sourcefile.peek() != EOF)
  </code></pre>
  
  <p>where sourcefile is my ifstream.</p>
  
  <p>However, it never stops looping, even though it has reached the end of the file. </p>
  
  <p>Does EOF not mean "End of File"? Or was I using it wrong?</p>