title: fstream not writing to file
body: <p>I'm having trouble with fstream not writing to my file when it is located in a specific place. In the following code when the commented line is uncommented the file is written to, however when it is commented the file is not written to at all. I've added a bunch of console output and it says both of the outputs around the "outputFile &lt;&lt; newWord &lt;&lt; endl;" are completed but the file is never actually written to.</p>
  
  <pre><code>void write_index( string newWord )
  {
  fstream outputFile( "H:\\newword.txt", ios::app );
  int same = 0;
  string currWord;
  currWord.resize(5);
  //outputFile &lt;&lt; newWord &lt;&lt; endl;
  while( !outputFile.eof() )
  {
      getline( outputFile, currWord );
      cout &lt;&lt; "Checking if " &lt;&lt; newWord &lt;&lt; "is the same as " &lt;&lt; currWord &lt;&lt; endl;
      if( newWord == currWord )
      {
          cout &lt;&lt; "It is the same" &lt;&lt; endl;
          same = 1;
          break;
      }
  }
  if( same != 1 )
  {
      cout &lt;&lt; "Writing " &lt;&lt; newWord &lt;&lt; "to file" &lt;&lt; endl;
      outputFile &lt;&lt; newWord &lt;&lt; endl;
      cout &lt;&lt; "Done writing" &lt;&lt; endl;
  }
  outputFile.close();
  </code></pre>
  
  <p>}</p>