Not reading from file
<p>I want to read each word from a file. It opens the file but it does not enter the while loop   </p>

<pre><code>  string x;
        ifstream inFile ("test.txt");
        if (!inFile) {
            cout &lt;&lt; "Unable to open file";
            exit(1); // terminate with error
        }

        while (inFile &gt;&gt; x) {
            cout &lt;&lt; "hi" &lt;&lt; endl;
        }
        cout &lt;&lt; "hsiwsdsc" &lt;&lt; endl;

        inFile.close();
</code></pre>
