I've got 2 chars.
Char 128
and Char 2
.
How do I turn these chars into the Short 640
in C?
I've tried
unsigned short getShort(unsigned char* array, int offset)
{
short returnVal;
char* a = slice(array, offset, offset+2);
memcpy(&returnVal, a, 2);
free(a);
return returnVal;
}
But that didn't work, it just displays it as 128
. What's the preferred method?