J
jamx
I need to compare the following values:
char buf[3];
/* buf is filled using COMport here... */
if (buf[0] == 0x85) {
/* do something */
}
But since 0x85 is bigger then char's maximum value this won't really
work. So how can i compare all bits of a char with a other byte, like
0x85 in this example???
I was thinking about casting the char to unsigned char, in the
if-statement. But im not sure if that will work flawlessly...
Greetings, Frank
char buf[3];
/* buf is filled using COMport here... */
if (buf[0] == 0x85) {
/* do something */
}
But since 0x85 is bigger then char's maximum value this won't really
work. So how can i compare all bits of a char with a other byte, like
0x85 in this example???
I was thinking about casting the char to unsigned char, in the
if-statement. But im not sure if that will work flawlessly...
Greetings, Frank