When reading a signed char, the value will never be 0xEE. IE:
#include <stdio.h>
int main()
{
char c = 0xEE;
if (c == 0xEE)
{
printf("Char c is 0xEE");
}
else
{
printf("Char c is NOT 0xEE");
}
}
The output will be
Char c is NOT 0xEE
When reading a signed character, the value will range from -0x7F to 0x80. An unsigned char is interpreted from 0x00 to 0xFF and is usually what you want for raw bytes.
Edit:
char aChar;
to
unsigned char aChar;
and it should work.
source
share