I have a character array that contains information that I want to populate into a structure. The array has the following data
0x01 0x7b 0xC0 0x08
How do I write a structure that will retreive information from this array in the following manner -->
the first three bits contain information a
the next 5 bits contain information b
the next 12 bits contain information c
the next 12 bits contain information d
typedef struct
{
unsigned long a : 3; // (0 for data given above)
unsigned long b : 5; // (1 for data given above)
unsigned long c : 12; // (7bc for data given above)
unsigned long d : 12; // (8 for data given above)
} Data;
does not seem to work. I work on an intel machine. Appreciate any help.



LinkBack URL
About LinkBacks



