[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Zero padding in g_strdup_printf




On Sat, 2008-02-02 at 15:03 -0500, Allin Cottrell wrote:
> On Sat, 2 Feb 2008, Kevin DeKorte wrote:
> 
> > Hi All,
> > 
> > I'm doing a command like this
> > 
> >  *length = g_strdup_printf("%02i:%02.1f", min, seconds);
> > 
> > And if min or seconds is < 10 then I don't get the leading zero 
> > like I would get in a printf. Is this a known bug.
> 
> Works for me.
> 
> allin myrtle:~$ pkg-config --modversion glib-2.0
> 2.14.1
> 
> > if min is 8 and sec is 5.1 I would expect length to be "08:05.1", 
> 
> Then you want the seconds to be printed to a width of 4, not 2.

Allin,

Your little test works fine here for me, and you were right, I needed it
to be 4 instead of 2...

Thanks!

Kevin (wearing the dunce cap)

-- 
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]