M
Michal Prinke
Hello,
Here are two questions on formatting values using printf():
1. How to strip trailing zeroes from float values?
printf("%f %f", 1.777, 1.2) displays "1.777000 1.200000",
while I want to have "1.777 1.2", without loosing 6-digit
precision.
2. Is it possible to pad values with other characters than
space and zero? printf(">%5s<", "abc") displays "> abc<".
I would like to have e.g. ">##abc<" or ">--abc<".
Thank you!
Here are two questions on formatting values using printf():
1. How to strip trailing zeroes from float values?
printf("%f %f", 1.777, 1.2) displays "1.777000 1.200000",
while I want to have "1.777 1.2", without loosing 6-digit
precision.
2. Is it possible to pad values with other characters than
space and zero? printf(">%5s<", "abc") displays "> abc<".
I would like to have e.g. ">##abc<" or ">--abc<".
Thank you!