Any Microsoft MBCS run-time library routine that handles only one multibyte character or one byte of a multibyte character expects an unsigned int argument (where 0x00 <= character value <= 0xFFFF and 0x00 <= byte value <= 0xFF ). An MBCS routine that handles multibyte bytes or characters in a string context expects a multibyte-character string to be represented as an unsigned char pointer.
Caution Each byte of a multibyte character can be represented in an 8-bit char. However, an SBCS or MBCS single-byte character of type char with a value greater than 0x7F is negative. When such a character is converted directly to an int or a long, the result is sign-extended by the compiler and can therefore yield unexpected results.
Therefore it is best to represent a byte of a multibyte character as an 8-bit unsigned char. Or, to avoid a negative result, simply convert a single-byte character of type char to an unsigned char before converting it to an int or a long.
Because some SBCS string-handling functions take (signed) char* parameters, a type mismatch compiler warning will result when _MBCS is defined. There are three ways to avoid this warning, listed in order of efficiency: