A problem with your code lies here
because shortBuf is an array of chars, the << 8 will move everything past the last bit. << keeps the type what it is, so you should doCode:g_Data[iter] = (shortBuf[1] << 8) | shortBuf[0];
Personally, I would use a union for this task however.Code:g_Data[iter] = (((short)shortBuf[1]) << 8) | shortBuf[0];




Reply With Quote