what's wrong here?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5605125/why-is-iostreameof-inside-a-loop-condition-considered-wrong">Why is iostream::eof inside a loop condition considered wrong?</a>  </p>
</blockquote>



<p>i used this code to replace the first " with `` and the second one with '' 
everything works just fine except it runs through the loop one more time after the last character is read and that makes the program print another character </p>

<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
using namespace std ;
void main ()
{
    ifstream infile;
    infile.open("infile.txt");
    ofstream outfile;
    outfile.open("outfile.txt");
    char c ;

    int i = 0 ;
    while ( !infile.eof() )
    { 
        infile.get(c)
            if (c=='\"')
            {
                i++ ;
                if (i%2==0)
                    outfile&lt;&lt;"\'\'";
                else 
                    outfile&lt;&lt;"``";
            }
            else 
                outfile&lt;&lt;c;
    }
    outfile.close();
    infile.close();
}
</code></pre>
