<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">
      <pre class="moz-quote-pre" wrap="">sprintf(sStringBuffer,"%6lu",(unsigned long)123456); 

</pre>
    </div>
    <div class="moz-cite-prefix">On 15.04.2024 13:59, Martin Záruba
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:198ab609-49d6-4c2f-bfdd-14009be6f311@volny.cz">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p><font face="Arial">obě varianty, tedy použít snprintf i zápis
          123456UL dávají stejný nesmysl. Nefunguje ani</font></p>
      <div
style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span
      style="color: #4e5b61;">  </span><span style="color: #00979d;">char</span><span
      style="color: #4e5b61;"> </span><span style="color: #d35400;">sStringBuffer</span><span
      style="color: #4e5b61;">[</span><span style="color: #005c5f;">50</span><span
      style="color: #4e5b61;">];</span></div><div><span
      style="color: #4e5b61;">  </span><span style="color: #00979d;">uint32_t</span><span
      style="color: #4e5b61;"> x=</span><span style="color: #005c5f;">123456UL</span><span
      style="color: #4e5b61;">;</span></div><span
      style="color: #4e5b61;">  </span><span style="color: #d35400;">sprintf</span><span
      style="color: #434f54;">(</span><span style="color: #4e5b61;">sStringBuffer,</span><span
      style="color: #005c5f;">"%6u"</span><span style="color: #4e5b61;">,x</span><span
      style="color: #434f54;">)</span><span style="color: #4e5b61;">; </span><div><span
      style="color: #4e5b61;">  </span><span style="color: #d35400;">Serial</span><span
      style="color: #4e5b61;">.</span><span style="color: #d35400;">print</span><span
      style="color: #434f54;">(</span><span style="color: #4e5b61;">sStringBuffer</span><span
      style="color: #434f54;">)</span><span style="color: #4e5b61;">;</span></div><font
      style="white-space: normal;" face="Arial">nicméně</font></div>
      <div
style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span
      style="color: #4e5b61;">  </span><span style="color: #00979d;">char</span><span
      style="color: #4e5b61;"> </span><span style="color: #d35400;">sStringBuffer</span><span
      style="color: #4e5b61;">[</span><span style="color: #005c5f;">50</span><span
      style="color: #4e5b61;">];</span></div><span
      style="color: #4e5b61;">  </span><span style="color: #d35400;">sprintf</span><span
      style="color: #434f54;">(</span><span style="color: #4e5b61;">sStringBuffer,</span><span
      style="color: #005c5f;">"%6u"</span><span style="color: #4e5b61;">,</span><span
      style="color: #005c5f;">123456</span><span style="color: #4e5b61;">/</span><span
      style="color: #005c5f;">2</span><span style="color: #434f54;">)</span><span
      style="color: #4e5b61;">; </span><div><span
      style="color: #4e5b61;">  </span><span style="color: #d35400;">Serial</span><span
      style="color: #4e5b61;">.</span><span style="color: #d35400;">print</span><span
      style="color: #434f54;">(</span><span style="color: #4e5b61;">sStringBuffer</span><span
      style="color: #434f54;">)</span><span style="color: #4e5b61;">;</span></div>

</div>
      <p><font face="Arial">dá správně 61728</font></p>
      <p><font face="Arial">takže to vypadá na chybu v snprintf<br>
        </font></p>
      <p><font face="Arial">ach jo.</font></p>
      <p><font face="Arial">Máte typ, co použít, aby to formátovalo
          správně a šlo udělat tabulku bez nutnosti u toho dostat amok?<br>
        </font></p>
    </blockquote>
    <br>
  </body>
</html>