Reading File in C++
<p>I am unable to figure out why my code is not able to open and read a file. What am i missing?</p>

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

int main (int argc, char * const argv[]) 
{
    string line;
    ifstream myfile ("input_file_1.txt");
    if (myfile.is_open())
    {
        while (!myfile.eof())
        {
            getline (myfile,line);
            cout &lt;&lt; line &lt;&lt; endl;
        }
    }
    else
    {
        cout &lt;&lt; "Was unable to open the file" &lt;&lt; endl;
    }

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

<p>The file "input_file_1.txt" is int he same directory as my .cpp file and it has read permissions. I even gave gave it 777 permissions and i was unable to read it.</p>

<p>Can anyone tell me what i am doing wrong? I really cannot figure it out....</p>
