title: Using localtime_s to create a timestamp? And using asctime_s. C++
body: <p>I am trying to create a timestamp and at the moment I am trying to output it to the screen.</p>
  
  <p>The function which I am attempting to use to do this is localtime_s. </p>
  
  <p>However I cannot get it to work and I cannot find any working examples of how to use this. </p>
  
  <p>I am encountering the following errors: </p>
  
  <ol>
  <li>Error   1   error C2660: 'localtime_s' : function does not take 1 arguments </li>
  <li>a value of type "errno_t" cannot be assigned to an entity of type "tm *"    </li>
  <li>argument of type "time_t *" is incompatible with parameter of type "tm *"   </li>
  <li><p>too few arguments in function call  </p>
  
  <pre><code>    time_t rawtime;
      struct tm * timeinfo;
  
      time(&amp;rawtime);
      timeinfo = localtime_s(&amp;rawtime);
      asctime(timeinfo);
      cout &lt;&lt; "Current local time and date: " &lt;&lt; timeinfo &lt;&lt; endl;
  </code></pre></li>
  </ol>
  
  <p>Can anyone please advise? </p>
  
  <p><strong>Edit</strong></p>
  
  <p>Using the answer to cover the cout problem, visual studio won't let me run asctime. So instead I tried using asctime_s which then displays 
  "no instance of overloaded function "asctime_s" matches the argument list, argument types are : (tm *, time_t *)"</p>
  
  <p>However using a pointer to timeinfo and rawtime causes further errors. </p>
  
  <p>The code is now:    </p>
  
  <pre><code>    time_t rawtime;
      tm timeinfo;
      errno_t result = localtime_s(&amp;timeinfo, &amp;rawtime);
      cout &lt;&lt; "Current local time and date: " &lt;&lt; asctime_s(&amp;timeinfo, &amp;rawtime) &lt;&lt; endl;
  </code></pre>
  
  <p>Kind Regards</p>