title: C++: get individual float values from a string line of floats
body: <p>Suppose we have a string line:</p>
  
  <p><code>14.6527 39.5652 -344.226 -3.34672</code></p>
  
  <p>Let's call this string, <code>str_line</code>.</p>
  
  <p>My question is, how can we parse this into a float array, <code>float data[4]</code>.</p>
  
  <p>I tried using getline from stringstream but to no avail (see below for representation of my code). Any help would be appreciated :)</p>
  
  <pre><code>for(int i=0;i&lt;4;i++){
    stringstream ss(str_line);
    ss.getline( str_line, 8, ' ' );
    data[i]=atof(ss);
  }
  </code></pre>