title: How to extract specific data from text file containing whitespace and newlines?
body: <p>I would like to extract and analyze data from a large text file. The data contains floats, integers and words.</p>
  
  <p>The way I thought of doing this is to extract a complete line (up to newline) using std::getline(). Then extract individual data from the line extracted before (extract until whitespace, then repeat).</p>
  
  <p>So far I have this:</p>
  
  <pre><code>int main( )
  {
      std::ifstream myfile;
      myfile.open( "example.txt", std::ios::in );
  
      if( !(myfile.is_open()) )
      {   std::cout &lt;&lt; "Error Opening File";
          std::exit(0);   }
  
      std::string firstline;
  
  
      while( myfile.good() )
      {
          std::getline( myfile, firstline);
          std::cout&lt;&lt; "\n" &lt;&lt; firstline &lt;&lt;"\n";
      }
  
      myfile.close();
      return 0;
  }
  </code></pre>
  
  <p>I have several problems:</p>
  
  <p>1) How do I extract up to a whitespace?</p>
  
  <p>2) What would be the best method of storing the data? There are about 7-9 data types, and the data file is large.</p>
  
  <p>EDIT: An example of the file would be:</p>
  
  <p>Result Time Current Path Requirements<br>
  PASS 04:31:05 14.3 Super_Duper_capacitor_413 -39.23<br>
  FAIL 04:31:45 13.2 Super_Duper_capacitor_413 -45.23<br>
  ...</p>
  
  <p>Ultimately I would like to analyze the data, but so far I'm more concerned about proper input/reading.</p>