I have an unsigned char that I am converting to string and I want exactly 2 hex characters regardless of the value in the char.
myvalue = 0; sprintf( ptr, "MyValue=%2bx",myvalue); results in: MyValue=0 but I want MyValue=00
The leading zero is never printed. I thought the 2 which is supposed to be with width would force it to always print 2 characters.
Is there some other trick?