When casting an
int
greater than 127 to a
char
, the result is not the expected one because the value is truncated.
char
is a signed type which can hold values from -128 to 127 (see also
MSDN[
^]).
Depending on your code you may use negative
int
s or the
unsigned char
type for non ASCII 8-bit characters.