VB.Net program to read the content of a file character by character
'Vb.Net program to read data from file
'character by character till the end of the file.
Imports System.IO
Imports System.Text
Module Module1
Sub Main()
Dim stream As New FileStream("C:\data.txt", FileMode.Open)
Dim val As Integer
Dim ch As Char
Dim flag As Boolean = True
Console.WriteLine("Content of file: ")
While (flag = True)
val = stream.ReadByte()
If (val < 0) Then
flag = False
Else
ch = Convert.ToChar(val)
Console.Write(ch)
End If
End While
End Sub
End Module
Content of file:
It is a book.
It is a table.
It is a fan.
Press any key to continue . . .
Table of Contents