Hi
we have a buffer say char array.[1].so the size will be 1 byte.
Now our problem is say we have 8 bits data say 10110101.
now this must be assigned to array[0] variable as 1 byte.
bit manipulation is not happening.kindly help us in this regard
If possible post us a sample code for the same
here we are posting sample code for the same
decleration:
struct aaa {
unsigned char buff1:1;
unsigned char buff2:1;
unsigned char buff3:1;
unsigned char buff4:1;
unsigned char buff5:1;
unsigned char buff6:1;
unsigned char buff7:1;
unsigned char buff8:1;
}complete_buff;
complete_buff->buf1=(unsigned char)0x01;;
complete_buff->buf2=(unsigned char)0X00;
complete_buff->buff3=(unsigned char)0x01;
complete_buff->buff4=(unsigned char)0x01;
complete_buff->buff5=(unsigned char)0x00;
complete_buff->buff6=(unsigned char)0x00;
complete_buff->buff7=(unsigned char)0x00;
complete_buff->buff8=(unsigned char)0x00;
char array[0]=(complete_buff->buff1>>7)| (complete_buff->buff2>>6)|(complete_buff->buff3>>5)|(complete_buff->buff4>>4)|(complete_buff->buff5>>3)|(complete_buff->buff6>>2)|(complete_buff->buff7>>1)|(complete_buff->buff8)