PRINTF doesn't print leading zeroes

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PRINTF doesn't print leading zeroes

1,596件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

1,450件の閲覧回数
michaelellis
Contributor II

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

0 件の賞賛
返信

1,450件の閲覧回数
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 件の賞賛
返信

1,450件の閲覧回数
michaelellis
Contributor II

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

Michael

0 件の賞賛
返信