title: how to use localtime_s with a pointer in c++
body: <p>I am working with a function in C++ to help get the integer for the month. I did some searching and found one that uses localtime but I do not want to set it up to remove warnings so I need to use <code>localtime_s</code>. but when I use that my pointer no longer works and I need someone to help me find what I am missing with the pointer.</p>
  
  <pre><code>#define __STDC_WANT_LIB_EXT1__ 1
  #include &lt;stdio.h&gt;
  #include &lt;Windows.h&gt;
  #include "FolderTask.h"
  #include &lt;ctime&gt; //used for getMonth
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  
  int getMonth()
  {
      struct tm newtime;
      time_t now = time(0);
      tm *ltm = localtime_s(&amp;newtime,&amp;now);
      int Month = 1 + ltm-&gt;tm_mon;
      return Month;
  }
  </code></pre>
  
  <p>the error I am getting is:</p>
  
  <blockquote>
    <p>error C2440: 'initializing': cannot convert from 'errno_t' to 'tm *'
    note: Conversion from integral type to pointer type requires
    reinterpret_cast, C-style cast or function-style cast</p>
  </blockquote>