Or you could do mapping. A structure is nothing but a piece of memory. Define a pointer to a block of the same size give this block a value. Then map the structure onto the block and assign it to the variable of that structure type. Hmm, hope this is understandable English. :-)
Anyway, here's an example which shows what I mean:
Code:
#include <stdio.h>
typedef struct
{
unsigned b1:1;
unsigned b2:1;
unsigned b3:1;
unsigned b4:1;
unsigned b5:1;
unsigned b6:1;
unsigned b7:1;
unsigned b8:1;
} byte_s;
int main()
{
byte_s bfbyte;
unsigned char *ucbyte;
*ucbyte = 0x00;
bfbyte = *((byte_s *) (ucbyte));
printf ("%d %d %d %d : %d %d %d %d \n",
bfbyte.b1, bfbyte.b2, bfbyte.b3, bfbyte.b4,
bfbyte.b5, bfbyte.b6, bfbyte.b7, bfbyte.b8);
*ucbyte = 0xFF;
bfbyte = *((byte_s *) (ucbyte));
printf ("%d %d %d %d : %d %d %d %d \n",
bfbyte.b1, bfbyte.b2, bfbyte.b3, bfbyte.b4,
bfbyte.b5, bfbyte.b6, bfbyte.b7, bfbyte.b8);
return 0;
}