title: aligning output of ofstream
body: <p>I wish to output data from my program to a text file. Here is a working example showing how I do it currently, where I also include the date/time (I am running Windows):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;time.h&gt;
  
  using namespace std;
  
  int main()
  {
  
  char dateStr [9];
  char timeStr [9];
  
  _strdate(dateStr);
  _strtime(timeStr);
  
  ofstream output("info.txt", ios::out);
  output &lt;&lt; "Start time part 1 " &lt;&lt; "\t" &lt;&lt; timeStr &lt;&lt; " on " &lt;&lt; dateStr &lt;&lt; "\n";
  output &lt;&lt; "Start time part 1000000 " &lt;&lt; "\t" &lt;&lt; timeStr &lt;&lt; " on " &lt;&lt; dateStr &lt;&lt; "\n";
  output.close();
  
  
  return 0;
  }
  </code></pre>
  
  <p>However the output of "info.txt" is not very readable to me as a user, since the time- and date stamp at the ends are not aligned. Here is the output:</p>
  
  <pre><code>Start time part 1   15:55:43 on 10/23/12
  Start time part 1000000     15:55:43 on 10/23/12
  </code></pre>
  
  <p>My question is, is there a way to align the latter part?</p>