Sprintf convert fail to convert 4bytes into hex


hello,

does sprintf can convert hex bigger 2 bytes ?

example:
code: [select]

    char str[20];
    sprintf(str, "hex: %08x", 0xaaabcdef);
    serial.println(str);


the output be:  0000cdef

it converts 2 right bytes,
am missing something?

thanks

am missing something?
when life gives lemons, make lemonade!

when life gives "long" variables, make long formatting!

code: [select]

  char str[20];
  sprintf(str, "hex: %08lx", 0xaaabcdef);
  serial.println(str);


Arduino Forum > Using Arduino > Programming Questions > Sprintf convert fail to convert 4bytes into hex


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code