How can I extract 12 bits from a 2 byte char array? [closed]

  bit, bitwise-operators, c++, char

I am working on extracting data from binary files. One of the data values is packed into two bytes, but only 12 of the 16 bits contain the relevant information:Packed data structure.

Does anyone have a method to extract the 12 bits seen in this image? Let the two bits be stored in an unsigned char buffer[2].

Source: Windows Questions C++

LEAVE A COMMENT