我的代码有问题。我将偏移值放入列表框中,然后读取它并在文件中查找它。我使用以下代码。
Dim bw As New BinaryWriter(File.Open(filename, FileMode.Open, FileAccess.ReadWrite))
Try
For j As Integer = 0 To ListBox2.Items.Count - 1
czytana = ListBox2.Items.Item(j)
tablica = czytana.Split(" ") ' czytana is in format OFFSET: BYTE BYTE, offset is a hex addr
tablica(0) = tablica(0).Replace(":", "") 'I remove : from "OFFSET:"
bw.BaseStream.Seek("&H" + tablica(0), SeekOrigin.Begin) ' in ex. I got tablica(0)=000CFDD6, and I want to get &HCFDD6, but what I get is &H000CFDD6
'some part of code in here which does its job properly
Next j
Catch ex As Exception
MsgBox(ex.Message)
End Try
bw.Close()
问题是:我需要使用 tablica(0) 作为偏移量,使用 tablica(1) 和 tablica(2) 作为字节。我想要做的是打开文件,选择偏移量并用 tablica(2) 替换。czytana 的格式为“tablica(0): tablica(1) tablica(2).
有人介意帮忙吗?:)