C++ Read Lines from File
<p>I'm learning File Handling in C++, but there is a problem here. I am trying to read a file.
This code is meant to output Hello World. but it outputs 0x22fed8.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;

using namespace std;

    int main()
    {
        fstream file;
        file.open("test.txt",ios::in|ios::out);
        file &lt;&lt; "Hello World";
        cout &lt;&lt; file;
        file.close();

        return 0;
    }
</code></pre>

<p>What am I doing wrong?</p>
