Unsigned char error!
I encountered a problem using Visual C++. my objective is to convert "char tmp" to a decimal number, but bcos char supports only -128 to 128 and i want it to be from 0 to 256, so i changed it to unsigned char instead. However, an error occurs when i use "unsigned char" with "sprintf". My code is as follows:
unsigned char tmp='a',buf;
num = atoi(buf);
Errors occurs when the above code is used:
"error C2664: 'sprintf' : cannot convert parameter 1 from 'unsigned char' to 'char *'
Is there other alternative methods to implement the codes above since i can't use "unsigned char" with "sprintf"?
Thanks a million!!!
sprintf prints to an array, not a char.
Likewise, atoi reads from an array.