我正在尝试读取二进制文件的第一个单词,它告诉我该文件包含多少步骤。在使用VB.net中的二进制数据时,我是一个完整的新手
最好的做法是什么?我只需要读取文件第一个单词的值 - 我不需要再做它了。
我找到了这段代码,但它只返回一个空字符串:
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim readStream As FileStream
Dim msg As String
Try
readStream = New FileStream("C:\FreeStyler\Chases\Quadzilla - RedGreenBlue - Shrinking Squares (Pattern 23) - Static.chb", FileMode.Open)
Dim readBinary As New BinaryReader(readStream)
msg = readBinary.ReadString()
MsgBox(msg)
readStream.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
提前致谢...
答案 0 :(得分:0)
试试这个......
readStream = New FileStream("C:\FreeStyler\Chases\Quadzilla - RedGreenBlue - Shrinking Squares (Pattern 23) - Static.chb", FileMode.Open)
Dim readBinary As New BinaryReader(readStream)
msg as Integer = readBinary.ReadInt32()
MsgBox(msg.ToString)
readStream.Close()