title: C - can I output formatted time to text file
body: <p>I want to output time to a text file, and the time should be formatted as (dd-mm-yy). I've referred to <a href="https://stackoverflow.com/questions/3673226/how-to-print-time-in-format-2009-08-10-181754-811">How to print time in format: 2009‐08‐10 18:17:54.811</a> (using code from top answer) and I am now stuck with this piece of code:</p>
  
  <pre><code>int main()
  {
      time_t timer;
      char buffer[26], line[50]; // Hoping to feed in date and time into a string (line[50])
      struct tm* tm_info;
  
      time(&amp;timer);
      tm_info = localtime(&amp;timer);
  
      strftime(buffer, 26, "%d-%m-%y %H:%M:%S", tm_info);
      puts(buffer);
  
  
      return 0;
  }
  </code></pre>
  
  <p>Which give mes an output of the current local time and date in the format (dd-mm-yy) and (hh-mm-ss) on stdout. So now I'm just wondering if I can feed this format into a text file as well.</p>
  
  <p>Thanks for any help.</p>