Message-ID: <19980415171434.9744.qmail@hotmail.com> From: "Trond Endrestol" To: space AT gold DOT com DOT br Cc: djgpp AT delorie DOT com Subject: Re: Individual Bits Content-Type: text/plain Date: Wed, 15 Apr 1998 19:14:33 CEST Precedence: bulk Hi! You must use bit fields, a struct, and a union (see my example below). Hope this helps. Trond Endrestøl. ------------------------------------------------------------------ #include typedef struct bits_in_a_byte { int Bit01 : 1; int Bit02 : 1; int Bit03 : 1; int Bit04 : 1; int Bit05 : 1; int Bit06 : 1; int Bit07 : 1; int Bit08 : 1; } bits_in_a_byte; typedef unsigned char byte; typedef union byte_and_bits { byte Byte; bits_in_a_byte Bits; } byte_and_bits; int main() { byte_and_bits MyByte; MyByte.Byte = 55; cout << (unsigned int)MyByte.Byte << endl; // Should display 55 MyByte.Bits.Bit08 = 1; cout << (unsigned int)MyByte.Byte << endl; // Should display 183 return 0; } ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com