PRINTF doesn't print leading zeroes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PRINTF doesn't print leading zeroes

664 Views
michaelellis
Contributor II

SDK v.2.0 for TWR-KV58F220M

 

The PRINTF function does not seem to print leading zeroes.  For example:

 

PRINTF("0x%08X\n\r", 0xabcdef42U);
PRINTF("0x%08X\n\r", 0xabcdefU);

 

generates an output of:

 

0xABCDEF42
0x  ABCDEF

Labels (1)
0 Kudos
3 Replies

518 Views
michaelellis
Contributor II

Why is this normal behavior?  To my understanding, printf() should print leading zeroes when using the %08X format.

0 Kudos

518 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Michael,

I think the Printf() function  omits the leading zero, this is a normal behaviour.

Sorry for not helping you.

BR

XiangJun Rong

0 Kudos

518 Views
michaelellis
Contributor II

Why is this normal behavior?  To my understanding, printf() should print leading zeroes when using the %08X format.

Michael

0 Kudos