We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm having trouble with the C51 sprintf formats. sprintf does not pad the output according to the width field sprintf(rs_send_line,"%2d:%2d -> ",hrs,(int)(m-(hrs*60))); sprintf(&rs_send_line[9],"%4.0fV at %3buuA %5.0fVhrs",v_last,current_per_strip,run_vhrs); yields the following output "4:00 -> 500V at 7uA 2000Vhrs" Why is the output not padded with blanks per the width field? Any suggestions would be appreciated. Thanks Allen
Are you sure the code you'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't specified the zero flag. What version of the compiler are you using? Stefan