vb读取字节中的某一位
双字节操作
Dim a&(1 To 16), i&, data&, n& a(1) = 1 For i = 2 To 16 a(i) = a(i - 1) * 2 Next data = 58038 n = 5 '从右往左查询data的第N位是0还是1 If (data And a(n)) = a(n) Then MsgBox "该位是1" Else MsgBox "该位是0" End If
双字节操作
Dim a&(1 To 16), i&, data&, n& a(1) = 1 For i = 2 To 16 a(i) = a(i - 1) * 2 Next data = 58038 n = 5 '从右往左查询data的第N位是0还是1 If (data And a(n)) = a(n) Then MsgBox "该位是1" Else MsgBox "该位是0" End If