I have tried this:
printf("%+03.6f",+1.2开发者_运维技巧);
but it gives me
+1.200000
what I need is
+001.200000
Any ideas?
The first number is the total number of characters, so you're asking it to provide minimum 6 digits of precision in a field of size 3 and it expands the width as needed to fit. Try 11 instead (width of your example output).
精彩评论