Read by using BinaryReader : BinaryReader « Stream File « VB.Net Tutorial






Imports System.IO


Public Class Tester
    Public Shared Sub Main
        Dim fs As System.IO.FileStream
        Dim r As System.IO.BinaryReader
        Dim buffer(100) As Char
        Dim mylength As Long
        fs = New System.IO.FileStream("test.txt", IO.FileMode.OpenOrCreate)
        r = New System.IO.BinaryReader(fs)
        mylength = fs.Length
        If mylength > 100 Then
            mylength = 100
        End If
        r.Read(buffer, 0, mylength)
        Console.WriteLine(buffer)
        r.Close()
        fs.Close()
    End Sub

End Class








13.25.BinaryReader
13.25.1.Read by using BinaryReader