title: C++ ifstream ofstream implementation?
body: <p>I have been writing this Pig Latin program to convert english to pig latin, and I have been having issues implementing the read in file and then subsequently outputing it to another txt file.</p>
  
  <p>This is what I have so far, but it wont compile because of </p>
  
  <pre><code>outputFile &lt;&lt; pigLatin(englishWord) &lt;&lt; ' ';
  </code></pre>
  
  <p>Here is the source code. Any suggestion to get it working? Thanks</p>
  
  <pre><code>void pigLatin(string englishWord)
  {
  string piglatinWord;
  bool truefalse = false;
  int letter = 0, wordLength = englishWord.length( );
  
  while (!truefalse &amp;&amp; letter &lt; wordLength) 
    {
      if (englishWord.substr(letter,1) == "a" || englishWord.substr(letter,1) == "e" ||englishWord.substr(letter,1) == "i" || englishWord.substr(letter,1) == "o" || englishWord.substr(letter,1) == "u")
          truefalse = true;
      else
          letter++; 
    }
  if (letter &gt; wordLength)
      piglatinWord = englishWord + "-way "; 
  else
  piglatinWord = englishWord.substr(letter, wordLength-letter) + englishWord.substr(0,letter)+ "-ay " ;
  cout &lt;&lt; piglatinWord; 
  }
  
  int main( )
  {
  ifstream inputFile;
  inputFile.open("PigLatinIn.txt");
  ofstream outputFile;
  outputFile.open("PigLatinOut.txt");
  string englishWord, engWords;
  bool done = false;
  int location;
  
  while(!inputFile.eof())
  {
      string englishWord;
      inputFile &gt;&gt; englishWord;
      outputFile &lt;&lt; pigLatin(englishWord) &lt;&lt; ' ';
  }
  
  {
  while (!done) 
    {
      location = engWords.find(" "); 
      if (location == -1)
        {
          done = true;
          location = engWords.length( );
        }
      englishWord = engWords.substr(0, location); 
      pigLatin(englishWord); 
  
      if (!done)
          engWords = engWords.substr(location + 1, engWords.length( ) - location + 1);
    }
  }
  cout &lt;&lt; endl;
  inputFile.close();
  outputFile.close();
  return 0;
  }
  </code></pre>