title: Using ifstream, ofstream and fstream
body: <ol>
  <li><p>Trying to read into a file the word, "beef"</p></li>
  <li><p>Later going and editing the contents of the file to whatever to user wants which will be stored in the string, "line"</p></li>
  <li><p>The file never displays and when I go to check it manually, the text file is blank.</p></li>
  </ol>
  
  <p></p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
      string line = { " " };
      ofstream file1;
      file1.open("beef.txt");
      file1 &lt;&lt; "beef" &lt;&lt; endl;
      file1.close();
      file1.open("beef.txt");
  
      if (file1.is_open())
      {
          cout &lt;&lt; "Enter what you would like to be contained in the file" &lt;&lt; endl;
          cin &gt;&gt; line;
          ofstream file1;
          file1 &lt;&lt; line &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>