VB.NET 操作16进制文件

' 用到System.IO.Stream类

Imports System.IO          '导入引用类
 
        Dim fs As FileStream
        Dim br As BinaryReader
        fs = New FileStream(“1.dat”, FileMode.Open, FileAccess.Read)
        br = New BinaryReader(fs)
        Dim sw As StreamWriter
        sw = New StreamWriter(“1.txt”)
 
        Dim header_ID As Char() = br.ReadChars(10)                  '10 bytes
        Dim header_card_type As Short = br.ReadInt16                '2 bytes
        Dim header_num_of_channel As Short = br.ReadInt16           '2 bytes
        Dim header_channel_no As Byte = br.ReadByte                 '1 bytes
        Dim header_num_of_scan As Long = br.ReadUInt32              '4 bytes
        Dim header_data_width As Short = br.ReadInt16               '2 bytes
        Dim header_channel_order As Short = br.ReadInt16            '2 bytes
        Dim header_ad_range As Short = br.ReadInt16                 '2 bytes
        Dim header_ad_rate As Double = br.ReadDouble                '8 bytes
        Dim header_num_of_channel_range As Short = br.ReadInt16     '2 bytes
        Dim header_start_data As Char() = br.ReadChars(8)           '8 bytes
        Dim header_start_time As Char() = br.ReadChars(8)           '8 bytes
        Dim header_start_millisec As Char() = br.ReadChars(3)       '3 bytes
        Dim header_reserved As Char() = br.ReadChars(6)             '6 bytes
         
        sw.Write(vbCrLf)
         
        sw.Close()
        fs.Close()
        br.Close()
原文地址:https://www.cnblogs.com/jmpep/p/4486294.html