我讀取了一個900字節的二進制文件,其中包含很多信息。
像這樣:如何從字節數組中獲取字節並獲取數字
Dim myFile As String = txt_mydir.Text + "\MY_FILE.BIN"
If IO.File.Exists(myFile) Then
Dim fInfo As New FileInfo(myFile)
Dim numBytes As Long = fInfo.Length
Dim fStream As New FileStream(myFile, FileMode.Open, FileAccess.Read)
Dim br As New BinaryReader(fStream)
Dim data As Byte() = br.ReadBytes(CInt(numBytes))
所有字節字節組中的 '數據' 結束。
現在我必須讀取用VB6結構編寫的數字到該文件中。結構是我的,我知道什麼是什麼,在哪裏。 例如,我需要一個VB.NET'短'的數字,它是在字節81和82. 其中我有所有其他基本數字類型出去。
如何從特定位置的「數據」中取出所需數量的字節,使用確切的長度並從中獲取適當的數字(short,int,double ...)?
一個循環,可以給你所需要的例子嗎? – Oded
我需要示例時如何舉例? –
數組的例子,你需要什麼值?輸入?當然,你可以給一些。 – Oded