Path: utzoo!utgpu!jarvis.csri.toronto.edu!torsqnt!tmsoft!masnet!canremote!mark.longo From: mark.longo@canremote.uucp (MARK LONGO) Newsgroups: comp.lang.c Subject: Re: Bit Fields Message-ID: <89111105491001@masnet.uucp> Date: 9 Nov 89 23:11:00 GMT Organization: Canada Remote Systems Limited, Mississauga, ON, Canada Lines: 49 I am having a small problem with the RESULT values I get when I call my FOSSIL. I called the request status [AH=03h] to check out what was happening in the com port, I received 6030h back which is correct: What I want to do is translate this HEX value into BINARY so I can check what `each bit' means: For example: 6030h = 0110000000110000 in base 2 This matches up to: from left to right: Position 5: indicates `clear to send' Position 6: indicates `data set ready' Etc , etc .. Now ALL I need to do is somehow convert this 6030h number into BITS because EVERY position is important to me. Does anyone know of a quick and painless way to do this? I was playing with BIT FIELDS, but this did not seem to work. It would be nice if i could do something like: struct modem { unsigned clear_to_send : 1; unsigned data_set_ready: 1; . . unsigned time_out :1; } code; <-------------+ | then put the 6030h into base 2 and throw it into code . Can it be done? Is there an easier way? Mark Longo --- * Via ProDoor 3.1aR Bit Systems ~ 330 megs ~ HST ~ Doors ~ (519)767-1755 * RNet 1.02: CanConf ~ Bit Systems ~ Guelph ~ 519-767-1755 HST