# Re: 怎么把一个档案(不论任何格式)用十六进制显视出来

Posted by 老怪 on July 18, 1998 at 14:55:42:

In Reply to: 怎么把一个档案(不论任何格式)用十六进制显视出来 posted by WalterCSS on July 13, 1998 at 02:12:51:

下面这个模组勉强可以做到显示的功能，但却不适合用来编辑，因为让每一 Chr
可以分清楚，我分别在 前后加了 "_" 及 " " 字元，要做到能看能编的程度，还
是用 Grid 功能的 EditBox 较好。

Dim Buff() As Byte, BHandle As Integer
Dim I As Long, RTCode As String
Dim MidString As String

RTCode = Chr(13) + Chr(10)
BHandle = FreeFile
Open "C:\test\strange" For Binary As #BHandle
ReDim Buff(LOF(BHandle) - 1)
Get #BHandle, , Buff
For I = 0 To UBound(Buff)
If (I + 1) Mod 8 = 0 Then
MidString = MidString + Right("_" + Hex(I), 2) _
+ " " + RTCode
Else
MidString = MidString + Right("_" + Hex(I), 2) + " "
End If
Next
Text1.Text = MidString
Close #BHandle

Follow Ups: