Imports System.IO
Public Class Tester
Public Shared Sub Main
Dim fsStream As New FileStream("test.txt", FileMode.Open, FileAccess.Read)
Dim srReader As New StreamReader(fsStream)
Try
srReader.BaseStream.Seek(0, SeekOrigin.Begin)
While srReader.Peek() > -1
Console.WriteLine(srReader.ReadLine())
End While
srReader.Close()
Catch ex As IOException
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
|