sprintf issue with 32 bits variables
alekmaul opened this issue · comments
alekmaul commented
When you want to use u32 and put content in a string, the result is not OK
here is an example:
sprintf((char *)tmphud, "%05Lu", (u32) hiscore);
example, if hiscore is 0000c350 for 50000, result is garbage
tmphud is defined with u8 tmphud[16];
Jeff Linahan commented
Does itoa work?
Vincent Milum Jr commented
So, it turns out the results are not entirely garbage, instead, it is only reading 16-bits at a time. So if you pass in a 32-bit value, you can print it as two consecutive 16-bit values. This, of course, isn't ideal.
alekmaul commented
Well, I need to investigate again this issues. I thought it was fixed with last version of tcc.
alekmaul commented