Re: 3.05: sprintf wrong hexadecimal output
Yes, using %4x wouldn't help because it just specifies the minimum number of spaces used to print the number. If the number uses more spaces, it will ignore the 4. However, if you want to print in hex, you should use unsigned variable instead. When using signed variable, it is not uncommon that the compiler will "up convert" the signed value to the machine's natural integer size or even bigger. To avoid sign extending, it should use unsigned variables. Having said that, RobotC doesn't support unsigned values other than byte. I have complaint about that before
because it makes RobotC not orthogonal (unsigned is not applicable to all data sizes). I still don't understand why this design decision is made. The only response I had was "RobotC is not ANSI C, so don't expect it to be compliant".