---- *David Rothschild* muáte am 08.03.98 zum Thema
---- *"Individual bits"* folgendes blubbern: ;)
DR> How do can I read the individual bits that are inside a byte?
You have to do Bit-Manipulations on the Byte:
If you want to check, if the 3rd Bit is set, do following:
BitToCheck% = 3 'Bit to Check
TestByte% = 56 'Byte to Test
IF (TestByte% AND 2 ^ BitToCheck%) 0 THEN
PRINT "Bit Set"
ELSE
PRINT "Bit NOT Set"
END IF
The only thing you have to do, is to insert the number of the Bit you
want to check. If you got the Byte in a String, then you have to VAL it
to an Integer.
But caution:
+---+---+---+---+---+---+---+---+
! 7 ! 6 ! 5 ! 4 ! 3 ! 2 ! 1 ! 0 !
+---+---+---+---+---+---+---+---+
The first Bit is Bit Number 0. So if you want to Check the FIRST Bit, set
BitToCheck% = 0. If you want to Check the eighth Bit, set BitToCheck% = 7!
Thiz Mail Copyright (C)1998 by Markus Treinen
All Rights Reserved.
--- RiziBizi
---------------
* Origin: Carl Ranseier ist tot... (2:2452/455.8)
|