请问在VB里怎样把一个字节(16进制)取出其高4位和低4位?
请问在VB里怎样把一个字节(16进制)取出其高4位和低4位?不知道在哪里看过好像用&&Hf来取低4位,但调试不通,请高手赐教,谢谢不好意思,只有20分。PrivateSu...
请问在VB里怎样把一个字节(16进制)取出其高4位和低4位?不知道在哪里看过好像用& &Hf来取低4位,但调试不通,请高手赐教,谢谢
不好意思,只有20分。
Private Sub Command1_Click()
Dim i As Long
Dim databyte As Byte
Dim lowbit As Byte, highbit As Byte
cdg1.Filter = "文本文件(*.txt)|*.txt"
cdg1.ShowOpen
file_name = cdg1.FileName
i = 1
Open cdg1.FileName For Binary Access Read As #1
Do While EOF(1) = 0
Seek 1, i
Get 1, , databyte
lowbit = databyte And &HF
highbit = databyte And &HF0
Text1.Text = Text1.Text & databyte & " " & lowbit & " " & highbit
i = i + 1 '指针加1
Loop
Close #1 '关闭文件
End Sub
请vlaoda 帮我看下这个程序,是我数据类型不对还 是别的原因,一直得不到正确的高低4位的值,谢谢 展开
不好意思,只有20分。
Private Sub Command1_Click()
Dim i As Long
Dim databyte As Byte
Dim lowbit As Byte, highbit As Byte
cdg1.Filter = "文本文件(*.txt)|*.txt"
cdg1.ShowOpen
file_name = cdg1.FileName
i = 1
Open cdg1.FileName For Binary Access Read As #1
Do While EOF(1) = 0
Seek 1, i
Get 1, , databyte
lowbit = databyte And &HF
highbit = databyte And &HF0
Text1.Text = Text1.Text & databyte & " " & lowbit & " " & highbit
i = i + 1 '指针加1
Loop
Close #1 '关闭文件
End Sub
请vlaoda 帮我看下这个程序,是我数据类型不对还 是别的原因,一直得不到正确的高低4位的值,谢谢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询