title: how do i save time to a file?
body: <p>i have a program that saves data to file and i want to put a time stamp of the current date/time on that log but when i try to write the time to the file it will not show up but the other data i write will.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  #include &lt;direct.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  
  using namespace std;
  
  string header_str = ("NULL");
  
  
  int main()
  {
  
  for(;;)
  {
  
  
          stringstream header(stringstream::in | stringstream::out);   
  
          header &lt;&lt; "datasdasdasd_";
  
           time_t rawtime;
  
           time ( &amp;rawtime );
  
          header &lt;&lt; ctime (&amp;rawtime);
          header_str = header.str();
  
          fstream filestr;
  
          filestr.open ("C:\\test.txt", fstream::in | fstream::out |   fstream::app | ios_base::binary | ios_base::out);
  
          for(;;)
          {
              filestr &lt;&lt; (header_str);
  
          }
  
          filestr.close();
  
  
  }
  
  return 0;
  }
  </code></pre>
  
  <p>anyone know how to fix this?</p>