title: Ifstream - Reset EOF bit
body: <p>I'm working with <code>ifstream</code>. I read until EOF bit is set (I need this way).</p>
  
  <p>Why then don't work this:</p>
  
  <pre><code>// IN is ifstream file. CH is char.
  
  if (IN.eof()) {
      IN.seekg(ios::beg);
      IN.clear();
  
      if (read((char*)&amp;CH, sizeof(CH)))
          cout &lt;&lt; "Succes.";
      else
          cout &lt;&lt; "Not S.";    
  }
  </code></pre>
  
  <p>The <code>read</code> function isn't success anytime. I try use <code>IN.setstate(ifstream::goodbit)</code> instead <code>IN.clear()</code> too. But it is the same, am I right?</p>