|
-
Jul 10th, 2006, 12:03 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] binary reading
what is a fast way of reading binary?
thnx in advance
-
Jul 10th, 2006, 12:12 AM
#2
Re: binary reading
Code:
Bit 1: 1
Bit 2: 2
Bit 3: 4
Bit 4: 8
Bit 5: 16
Bit 6: 32
Bit 7: 64
Bit 8: 128
Hex 1 = 1
Hex 2 = 2
Hex 4 = 4
Hex 8 = 8
Hex 10 = 16
Hex 20 = 32
Hex 40 = 64
Hex 80 = 128
VB Code:
Dim bytSample As Byte
bytSample = 173
Debug.Print "Number is " & bytSample
Debug.Print "Bit 1 active: " & ((bytSample And &H1) = &H1)
Debug.Print "Bit 2 active: " & ((bytSample And &H2) = &H2)
Debug.Print "Bit 3 active: " & ((bytSample And &H4) = &H4)
Debug.Print "Bit 4 active: " & ((bytSample And &H8) = &H8)
Debug.Print "Bit 5 active: " & ((bytSample And &H10) = &H10)
Debug.Print "Bit 6 active: " & ((bytSample And &H20) = &H20)
Debug.Print "Bit 7 active: " & ((bytSample And &H40) = &H40)
Debug.Print "Bit 8 active: " & ((bytSample And &H80) = &H80)
When a Boolean (which is the end result of a comparison in the debug line) is coerced to a string, you'll see True or False, although in the language of Windows (ie. if you'd have Finnish Windows, you'd see Tosi or Epätosi instead of True or False).
-
Jul 10th, 2006, 01:01 AM
#3
-
Jul 10th, 2006, 10:58 AM
#4
Thread Starter
Frenzied Member
Re: binary reading
with some changes in penegate's code example, i've managed to do it
solution:
VB Code:
Dim fPath As String
Dim fFile As String
Dim FF As Long
FF = FreeFile()
Open fPath For Binary Access Read Lock Write As #FF
fFile = Space(LOF(FF))
Get #FF, , fFile
Close #FF
fFile = Replace(fFile, Chr(0), "")
txtFile.Text = fFile
btw, i used this to read a .reg file. the reason why i don't use normal input is because somehow it tends to leave quotation marks out
Last edited by TheBigB; Jul 10th, 2006 at 11:02 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|