הכנסתי את קובץ הקלט הבא:http://n.rotter.net/User_files/nor/4001d73a5f63b994.txt
והפעלתי את הקוד הבא:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
Dim mychr As Integer
oRead = oFile.OpenText("text_demo.txt")
Dim EntireFile As String
Dim num As String
EntireFile = " "
While oRead.Peek <> -1
mychr = oRead.Read()
' Convert the integer value into a hex value as string
num = Hex(mychr)
EntireFile = EntireFile + "0x" + num + " "
End While
TextBox1.Text = EntireFile
End Subכדי לקבל את הפלט הבא
0x68 0x65 0x6C 0x6C 0x6F 0x20 0xD 0xA 0x74 0x68 0x69 0x73 0x20 0x69 0x73 0x20 0x61 0x20 0x74 0x65 0x78 0x74 0x20 0x66 0x69 0x6C 0x65