title: escape character '-' in a sscanf() function
body: <p>The problem is very simple, I have a date column in my database postgres, it returns the value as string in the format <strong>yyyy-mm-dd</strong>, in order to store it in my code, I need to parse the value.
  The function is also very simple:</p>
  <pre><code>int parse_date(const char * s, tbDate*res)
  {
      int yyyy, mm, dd;
      if (sscanf(s, &quot;%d %d %d&quot;, &amp;yyyy, &amp;mm, &amp;dd) == 3
              || sscanf(s, &quot;%d.%d.%d&quot;, &amp;yyyy, &amp;mm, &amp;dd) == 3
              || sscanf(s, &quot;%d/%d/%d&quot;, &amp;yyyy, &amp;mm, &amp;dd) == 3
              || sscanf(s, &quot;%d-%d-%d&quot;, &amp;yyyy, &amp;mm, &amp;dd) == 3)
      {
          if (mm &gt; 0 &amp;&amp; mm &lt; 13 &amp;&amp; dd&gt;0 &amp;&amp; dd &lt; 32)
          {
              res-&gt;day = dd;
              res-&gt;month = mm;
              res-&gt;year = yyyy;
              return TB_PARSE_SUCCESS;
          }
      }
      return TB_PARSE_FAILURE;
  }
  </code></pre>
  <p>The first three versions of <strong>sscanf()</strong> work very well, but the follow <strong>sscanf(s, &quot;%d-%d-%d&quot;, &amp;yyyy, &amp;mm, &amp;dd)</strong> , the format that the database  returns, are read as negative value, it means that if I pass a date  like <strong>'2022-12-03'</strong>, <strong>yyyy</strong> is correctly 2022, but <strong>mm</strong> and <strong>dd</strong>, are -12 and -3. I would avoid to put a date format function in the query of the database, and I would know if there is a way to escape the <strong>-</strong> charachter inside the <strong>sscanf()</strong>.</p>