[OT] printf format specifier
Hi, I thought that %02.1f would print floating points as xx.x or 0x.x but it does not. It prints x.x or xx.x. How do I ensure that there always are 2 digits before the floating point? Thanks! H -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: [OT] printf format specifier
Hugo Vanwoerkom wrote on Dec, 27: [...] I thought that %02.1f would print floating points as xx.x or 0x.x but it does not. It prints x.x or xx.x. How do I ensure that there always are 2 digits before the floating point? Please allow me to recommend a very good discussion group for questions such as yours: comp.lang.c You can access it through: http://groups.google.com/ You just subscribe and can post your doubt straight away. I've done it before and the guys over there are really helpful and speedy. Regards, Paulo -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: [OT] printf format specifier
On 2005-12-27 10:58:54, Hugo Vanwoerkom wrote: Hi, I thought that %02.1f would print floating points as xx.x or 0x.x but it does not. It prints x.x or xx.x. How do I ensure that there always are 2 digits before the floating point? Try %04.1f, since xx.x has length 4, not 2. I must admit I overlooked that at first too ;-) Felix -- Felix C. Stegerman [EMAIL PROTECTED] Any sufficiently advanced bug is indistinguishable from a feature. -- R. Kulawiec -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: [OT] printf format specifier
Felix C. Stegerman wrote: On 2005-12-27 10:58:54, Hugo Vanwoerkom wrote: Hi, I thought that %02.1f would print floating points as xx.x or 0x.x but it does not. It prints x.x or xx.x. How do I ensure that there always are 2 digits before the floating point? Try %04.1f, since xx.x has length 4, not 2. I must admit I overlooked that at first too ;-) Thanks Felix! That's it! Dumb of me! H -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]