C++ filereader giving error
<p>I got code for a filereader for C++ from a website but I can't seem to get it to work for me, is there something wrong with the code  or should I just use something else to read text form a textfile?</p>

<p>The Error I get is: </p>

<p>E:\IT-C++\snake.cpp||In function 'int main()':|
E:\IT-C++\snake.cpp|11|error: could not convert 'infile.std::basic_ios&lt;_CharT, _Traits>::eof [with _CharT = char, _Traits = std::char_traits]' to 'bool'|
E:\IT-C++\snake.cpp|11|error: in argument to unary !|
||=== Build finished: 2 errors, 0 warnings ===|</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

int main ()
{
        string STRING;
    ifstream infile;
    infile.open ("names.txt");
        while(!infile.eof) // To get you all the lines.
        {
            getline(infile,STRING); // Saves the line in STRING.
            cout&lt;&lt;STRING; // Prints our STRING.
        }
    infile.close();

}
</code></pre>
