title: Reading only doubles from a file of strings, char, and doubles
body: <p>This is a sample of the file I have (this is one line):</p>
  
  <pre><code>B12                          MN =                              1.2                         G_{I}=                          3.4                               G_{B}  =                           9.4                        J_k =                               4.4                  1.4                      0.4                   -0.1                       -0.1               3.3                 9.3                      -5.7                 2
  </code></pre>
  
  <p>Now, my trouble is that I need to be a able to read this file and get the numbers I'm interested in into another file.</p>
  
  <p>So, I tried this:</p>
  
  <pre><code>ifstream in("Data.dat")
  ofstream out
  output.open("Output.dat")
  
  double a1, ..., a12; 
  
  while(1) {
             if(!(in &gt;&gt; a1 &gt;&gt; ... &gt;&gt; a12))
             break;
  
             output &lt;&lt; a1 &lt;&lt; a2 &lt;&lt; a12; //say these are the three doubles I'm interested in.
  
  
  }
  </code></pre>
  
  <p>However, this failed. I don't get anything in the output file. I really have no clue how to fix this.</p>
  
  <p>Any suggestions?</p>