Printf and sscanf doesn't work for %hhx
Printf and sscanf doesn't work for %hhx
It appears that printf and sscanf don't work with %hhx (for unt8_t). %hx works just fine for uint16. I know that newlib nano doesn't support 64-bit. Does it not support 8-bit either?
Re: Printf and sscanf doesn't work for %hhx
If you have selected nano formats option in newlib, hhx will not work (as all other C99 formats).
Re: Printf and sscanf doesn't work for %hhx
So what's the proper way to sscanf a 2 or printf a uint8_t?
Re: Printf and sscanf doesn't work for %hhx
You have two options:
- disable nano formatting and use these C99 formats
- like everyone did pre-C99, cast to an (unsigned) int in printf, and sscanf into an intermediate (unsigned) int variable, then copy into uint8_t.
- disable nano formatting and use these C99 formats
- like everyone did pre-C99, cast to an (unsigned) int in printf, and sscanf into an intermediate (unsigned) int variable, then copy into uint8_t.
Who is online
Users browsing this forum: No registered users and 256 guests