I am reading file but while reading,it is reading last character one time extra?
<p>I am trying to read file by following code</p>

<pre><code>void main()
{ 
   int i=0;
   ifstream fout1 ("Aj.txt",ios::binary);
   if (fout1.is_open())
   {
      while(fout1)
      {
         i++;
         fout1.get(ch1);
         cout&lt;&lt;ch1;
      }
      cout&lt;&lt;i;
      fout1.close();
    }
    else
    { 
       cout &lt;&lt; "Unable to open file";
    }
    return 0;
 }
</code></pre>

<p>here this code reads whole file but it goes into loop one extra time i.e if there are 4character in file then in loop it will iterate 5 time .how to correct it or overcome it.</p>
