[Top][All Lists]

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

[avr-chat] Printf with leading zeros?

From: Rick Mann
Subject: [avr-chat] Printf with leading zeros?
Date: Tue, 1 Feb 2011 01:19:15 -0800

I'm trying to output a byte as a hex value with zero padding. I do something 
like this:

        uint8_t val = 4;
        int len = snprintf((char*) sBuf, 64, "%02x\r\n", val);

But when I do this, the output I get is "4", not "04".

This is with the minimal library.

Trying with the floating point version, it seems to work correctly.

Is this a bug?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]