title: Mixing ifstream getline and >>
body: <p>After using a <code>&gt;&gt;</code> to input a <code>float</code> value, getline ceases to work correctly and reads trash. How can I avoid this?</p>
  
  <pre><code>   string settingsFile = "TerrainSettings.txt";
  
     ifstream settingsStream;
  
     settingsStream.open(settingsFile.data());
     assert (settingsStream.is_open());
  
     string line;
  
     getline(settingsStream,line); // fine here
     getline(settingsStream,line); // fine here
     getline(settingsStream,line); // fine here
  
     float frequency;
     float octaves;
     float amplitude;
  
     settingsStream&gt;&gt;frequency; // fine here
  
     getline(settingsStream,line); // here it gets trash, why? 
  
     settingsStream&gt;&gt;octaves; // trash
  
     getline(settingsStream,line);
  
     settingsStream&gt;&gt;amplitude;
  </code></pre>
  
  <p>Edit: An inclusion of ignore(), generates the following error:</p>
  
  <pre><code>   settingsStream&gt;&gt;frequency;
  
     settingsStream.ignore(256,'\n');
  
     getline(settingsStream,line); // fine here 
  
     settingsStream&gt;&gt;octaves; // trash here
  
     getline(settingsStream,line);
  
     settingsStream&gt;&gt;amplitude;
  </code></pre>
  
  <p>sample input:</p>
  
  <pre><code>/*Settings for Terrain Rendering, please input values on their respective lines*/
  /**/
  Frequency:                
  24
  Octaves:                   
  120
  Amplitude:                 
  1.25
  </code></pre>