title: Extract specific information from file C++
body: <p>I'm trying to read a file using c++ but I am only looking to store certain things. This is what my file looks like </p>
  
  <pre><code>stufff
  stuff
  more stuff
      .
      .
      .
  data_I_want 32 34 45
  data_I_want 52 22 34
  stuff again
      .
      .
      .
  end of file
  </code></pre>
  
  <p>So far I have written this code, but the output is always 0. </p>
  
  <pre><code>ifstream file;
  file.open("stuff.txt");
  string line;
  double v;
  if(file.is_open()){
      while(getline(file,line) &amp;&amp; line.compare("data_I_want")){
              file&gt;&gt;v;
              cout&lt;&lt;v&lt;&lt;endl;
      }
      file.close();
  }
  </code></pre>