Skip reading characters from a data file C++
<p>I have a data file (A.dat) with following format:</p>

<pre><code>Theta = 0.0000        Phi = 0.00000
Theta = 1.0000        Phi = 90.0000
Theta = 2.0000        Phi = 180.0000
Theta = 3.0000        Phi = 360.0000
</code></pre>

<p>I want to read the values (only) of theta and phi and store them in a data file (B.dat) like this:</p>

<pre><code>0.0000        0.00000
1.0000        90.0000
2.0000        180.0000
3.0000        360.0000
</code></pre>

<p>I tried this :</p>

<pre><code>    int main()
    {

      double C[4][2];

      ifstream fR;
      fR.open("A.dat");
      if (fR.is_open())
        {
          for(int i = 0; i&lt;4; i++)
            fR &gt;&gt; C[i][0] &gt;&gt; C[i][1];  
        }
      else cout &lt;&lt; "Unable to open file to read" &lt;&lt; endl;
      fR.close();

      ofstream fW;
      fW.open("B.dat");

      for(int i = 0; i&lt;4; i++)
        fW &lt;&lt; C[i][0] &lt;&lt; '\t' &lt;&lt; C[i][1] &lt;&lt; endl;

      fW.close();
    }
</code></pre>

<p>I get this in B.dat:</p>

<pre><code>0       6.95272e-310
6.95272e-310    6.93208e-310
1.52888e-314    2.07341e-317
2.07271e-317    6.95272e-310
</code></pre>

<p>How do I skip reading characters and other things and save only the digits?</p>