StreamReader: read to a buffer : StreamReader « Stream File « VB.Net Tutorial






Imports System.IO


Public Class Tester
    Public Shared Sub Main
        Dim f As System.IO.FileStream
        Dim r As System.IO.StreamReader
        Dim mylength As Integer
        Dim i As Integer
        Dim mybuffer(100) As Char
        f = New System.IO.FileStream("test.txt", IO.FileMode.Open, IO.FileAccess.Read)
        r = New System.IO.StreamReader(f)
        r.Read(mybuffer, 0, 100)
        Console.WriteLine(mybuffer)
        f.Close()
        r.Close()

    End Sub
End Class








13.18.StreamReader
13.18.1.Create StreamReader from FileStream
13.18.2.Read text file to the end
13.18.3.Read all text in a text file by using StreamReader
13.18.4.Read text file to a char array
13.18.5.StreamReader: read to a buffer
13.18.6.StreamReader: Peek
13.18.7.Check Exception in file reading
13.18.8.Use Finally clause to close a stream