<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>sprintf width problem</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/33500/sprintf-width-problem</link><description> I&amp;#39;m having trouble with the C51 sprintf formats. 
sprintf does not pad the output according to the width field 
 
sprintf(rs_send_line,&amp;quot;%2d:%2d -&amp;gt; &amp;quot;,hrs,(int)(m-(hrs*60))); 
sprintf(&amp;amp;rs_send_line[9],&amp;quot;%4.0fV at %3buuA %5.0fVhrs&amp;quot;,v_last,current_per_strip</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: sprintf width problem</title><link>https://community.arm.com/thread/40136?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2003 03:49:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d6b27341-049a-4764-951f-2fc3fd82bfc8</guid><dc:creator>John Donaldson</dc:creator><description>&lt;p&gt;Are you sure the code you&amp;#39;ve posted is really the code that is producing that output? I ask because the second %d has left padded the output with zeros (which seems to be exactly what you want) even though you haven&amp;#39;t specified the zero flag.&lt;br /&gt;
&lt;br /&gt;
What version of the compiler are you using?&lt;br /&gt;
&lt;br /&gt;
Stefan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>