title: fstream file empty (easy small code)
body: <p>i made this easy code to try this <code>fstream file ("....txt")</code>  but the <strong>file stays empty</strong> !
  can someone please help ?
  (note that i have a <strong>"selfmade" header</strong> file that includes all the files i normally use and the namespace)</p>
  
  <p>This small programm should cout everything from the <strong>File.txt</strong> and then give you the chance to type new lines to the file, to break the cin progress you use break. but like i said the file stays empty</p>
  
  <pre><code>#include &lt;myHead.h&gt;
  
  int main()
  {
      string line;
      int i;
      fstream myFile ("File.txt");
  
      if (myFile.is_open())
      {
          while (getline(myFile,line))
          {
              cout &lt;&lt; line &lt;&lt; "\n";
          }
  
          line = "0";
  
          for(line;line!="break";cin &gt;&gt; line)
      {
          if(line != "break")
              myFile &lt;&lt; line;
      }
  
          myFile.close();
  
      }
      else
          cout &lt;&lt; "error, File.txt cannot be opened!";
  
      getch();
      return 0;
  }
  </code></pre>