title: How do I open a .txt file in C++?
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main () {
    string line;
    ifstream myfile("hey.txt");
  
    myfile &gt;&gt; line;
    cout &lt;&lt; line;
    system("pause");
    return 0;
  }
  </code></pre>
  
  <p>Why does this not print out what is in my "hey.txt" file?</p>