<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix"><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:#434f54">UL)</span><span
style="color:#4e5b61">; <br>
</span></div>
<div class="moz-cite-prefix"><span style="color:#4e5b61"><br>
</span></div>
<div class="moz-cite-prefix"><span style="color:#4e5b61">Asi to bere
konstantu implicitne jako 16b</span></div>
<div class="moz-cite-prefix"><span style="color:#4e5b61"><br>
</span></div>
<div class="moz-cite-prefix"><span style="color:#4e5b61"><br>
</span></div>
<div class="moz-cite-prefix">Dne 15.04.2024 v 13:38 Jindroush
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:H%7BM.7xUh.pGWSvsUtlK.1c7H7D@seznam.cz">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Prostě se to někde orizne na 16bitů. Nemá to být ul?
<div>Opět upozorňuji na zdravý zvyk používat snprintf... </div>
<div>J. <br>
<br>
<aside>---------- Původní e-mail ----------<br>
Od: Martin Záruba <a class="moz-txt-link-rfc2396E" href="mailto:swz@volny.cz"><swz@volny.cz></a><br>
Komu: Martin Zaruba <a class="moz-txt-link-rfc2396E" href="mailto:hw-list@list.hw.cz"><hw-list@list.hw.cz></a><br>
Datum: 15.04.2024 13:35:10<br>
Předmět: sprintf - co dělám blbě?<br>
</aside>
<br>
<blockquote><br>
<p>Tento triviální kousek programu <br>
<br>
</p>
<br>
<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:#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:#434f54">(</span><span style="color:#00979d">uint32_t</span><span
style="color:#434f54">)</span><span style="color:#005c5f">123456</span><span
style="color:#434f54">)</span><span style="color:#4e5b61">; </span></div><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>
<br>
<br>
<p>vrací hodnotu 57920. Ale proč?<br>
<br>
</p>
<br>
<pre class="-wm-moz-signature">--
Martin Záruba</pre>
<br>
<br>
<br>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>