http://hi.baidu.com/xa87/blog/item/5fc9df0abe10e91d94ca6b3a.html
Dim Data() As Byte '原结果,字节型 Dim i As Long '循环变量 Dim a As String '转换后的结果 Dim cn As Boolean '是否为中文,中文占两字节,当前字节和下一字节 ReDim Data(0) open "c:/temp/b.txt" for binary access read as #1 '以二进制方式打开该文件 For i = 1 To 20 Step 1 ReDim Preserve Data(UBound(Data) + 1) Get #1,i,Data(i) If Data(i) >= 127 Then '汉字 If cn = True Then a = a & Chr("&H" & Hex(Data(i - 1)) & Hex(Data(i))) '将前后两字节转换为汉字 cn = False Else cn = True End If Else a = a & Chr(Data(i )) End If Next i MsgBox a,4096 '输出转换后的结果
原文链接:https://www.f2er.com/vb/261647.html