Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By FreddyVictor
#79391
QuickFix wrote:An integer value can't contain a precision specifier (the "." dot), try this instead:
Code: Select allSerial.printf("Time: %2d:%2d:%2d", 10, 11, 5);

Thanks for your quick reply ;)
Your code is using the width format specifier

Your link to the reference page shows:
.precision
.number
For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros.

This works in all other c compilers I've used
I really can't believe I'm the first to notice this
Or is this just a 'known feature' ?
User avatar
By QuickFix
#79397 Ah yes, ignore my reply; just like with my own language (Pascal) you should be able to use precision with integer values in C++, not sure why it doesn't in your example.