0
    Private Sub LRbtn_Click(sender As Object, e As EventArgs) Handles LRbtn.Click
    OpenFileDialog1.Title = "Please Select a File"
    OpenFileDialog1.ShowDialog()
    Dim filename As String = OpenFileDialog1.FileName
    Dim fs As FileStream = New FileStream(filename, FileMode.Open)
    Dim br As BinaryReader = New BinaryReader(fs)
    br.BaseStream.Seek(verOffset, SeekOrigin.Begin)
    a = br.ReadInt32()
    verLabel.Text = hex2ascii(Hex(a))
    br.Close()
    fs.Close()

End Sub

我正在打开并二进制读取一个文件,然后我在给定地址读取 4 个字节。

因此,例如,变量a可能是1163022402转换为十六进制的变量是45,52,50,42

转换a为十六进制后,我需要反转字节以获得42,50,52,45

我是VB的新手,我正在学习它,我该怎么办?谢谢!

4

1 回答 1

0

如果您需要 32 位,只需读取 4 个字节就可以使用br.ReadBytes,那么您可以随意订购它们

于 2012-11-10T09:09:27.573 回答