title: Replacing symbols with spaces in a string
body: <p>I'm writing a program that can format text files of thousands of lines of data. The input text file are lines such as:</p>
  
  <blockquote>
    <p>2010-01-01 00:00:00   0.520368    0.558565    0.567376</p>
  </blockquote>
  
  <p>What I want to do is replace the dashes and ':' with spaces, and then put proper tabs in. I figured out how to fix the tab problem, but my algorithm for replacement just does not work. Any help is greatly appreciated. My code currently looks like this:</p>
  
  <pre><code>void getReportInfo(ifstream&amp; file, ofstream&amp; ofile)
  {
    string date, time;
    double wheight1, wheight2, wheight3;
  
  
           while(!file.eof())
           {
             file &gt;&gt; date &gt;&gt; time &gt;&gt; wheight1 &gt;&gt; wheight2 &gt;&gt; wheight3;
  
             //replace dashes 
             for(int i = 0; i &lt; date.length(); i++) {
               if(date[i]== '-')
                 date[i] == ' ';
             }
             ofile &lt;&lt; date &lt;&lt; " ";
  
             //replace colons
             for(int i = 0; i &lt; time.length(); i++) {
               if(time[i]== ':')
                 time[i] == ' ';
             }
             ofile &lt;&lt; time &lt;&lt; " ";
  
             ofile &lt;&lt; "\t" &lt;&lt; wheight1 &lt;&lt; " \t" &lt;&lt; wheight2 &lt;&lt; " \t" &lt;&lt; wheight3 &lt;&lt; endl;
           }
  }
  </code></pre>