Hope you see this. My experience with follow up posts is not very good.
Actually what I am trying to do is to read a binary file and parse it. I
could not find anything on the Web. After much searching and experimentation,
my code has evolved to:
Dim oFile As New FileInfo(FILE_NAME)
Dim iSize As Long = oFile.Length
Dim fs As New FileStream(FILE_NAME, FileMode.Open, FileAccess.Read)
Dim r As New BinaryReader(fs)
Dim arrBytes() As Byte = r.ReadBytes(CInt(iSize))
Dim i As Integer
Dim sbFile As New StringBuilder
Dim s0 As String = "0"
For i = 0 To arrBytes.Length - 1
sbFile = sbFile.Append(s0.Substring(0, 2 -
Hex(arrBytes(i)).Length) & Hex(arrBytes(i)).ToString)
Next
Dim str As String = sbFile.ToString
At this point, all I need to do is to convert 46 to "F" as shown in the
second char below. In the second example, I need to capture the numeric
value of the first 8 bytes.
Sample lines from the file can be:
20 46 49 4E 20 49 56 44 6F 20 4F 4E 4C 20 4F 55 - - - ( FIN IVDo ONL OU
or
30 A3 07 9B 48 63 C3 01 00 00 00 00 00 00 00 00 - - - (0...Hc..........)
I bet there is an easy way to do this parsing but I can't figure it out. My
approach seems to work but I need the conversion of 46 to "F", etc.
Your suggestion of Val() or CInt() does not work because neither is happy
with "4C".
PS. You have helped me numerous times, in most cases your response was
right on target. My current software project would not be where it is
without you. It seems like I almost know you. From the amount of responses
that you provide, it seems like you must be more than one person. Similar to
Mr. Goodwrench of GM.