2023-10-29 06:58 AM
What is the best way to use sscanf with uint8_t?
When I use:
uint8_t x ;
char* y = "23" ;
sscanf ( y , "%hhu" , &x ) ;
I stuck at:
void HardFault_Handler(void)
I found following workaround that works:
uint16_t x1 ;
uint8_t x2 ;
const char* y = "23" ;
sscanf ( y , "%hu" , &x1 ) ;
x2 = (uint8_t) x1 ;
but it doesn't look best. So what is the right way of processing uint8_t in above case?
V/r
yabool2001
Solved! Go to Solution.
2023-11-14 12:58 PM
Likely because I'm a fossil and predominantly code to older K&R and C89 standards some of my tool chains use..
b) support only conversion specifiers defined in C89 standard. This brings us good balance between small memory footprint and full feature formatted input/output.
https://github.com/32bitmicro/newlib-nano-1.0/blob/master/newlib/README.nano#L29
2023-11-19 09:56 AM
Thx.