I stuff all the 'bits' into an array and pick through that to get the individual values. Something like..
Code:
sTest = "SomeBytes" ' Raw data Redim BitArray(Len(sTest)*8) ' BitArray() As String ("1"s and "0"'s) bp = StrPtr(sTest) ' bp as Byte Ptr For b = 0 To Len(sTest)-1 ' one byte at a time TempChar = Bin$(@bp[b],8) ' TempChar => 'Binary' string For c = 1 To 8 ' one bit at a time BitArray(i) = Mid$(TempChar, c, 1) ' build bit array Incr i Next Next For i = 3 To 6 ' e.g. group of bits sGroup += BitArray(i) Next ExampleRes? = Val("&B0"+sGroup)
Leave a comment: