<html><body>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 <swz@volny.cz><br>Komu: Martin Zaruba <hw-list@list.hw.cz><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><br><br></div><br> <p></p><br> <p>vrací hodnotu 57920. Ale proč?<br><br> </p><br> <pre class="-wm-moz-signature">-- <br><br>Martin Záruba</pre><br> <br><br></blockquote></div></body></html>