Article about reading the Text file line by line using the StreamReader in C#
Namespace :
using System.IO;
Code:
string line;
// Read the file and display it line by line.
StreamReader file = new StreamReader(@"c:\test.txt");
while((line = file.ReadLine()) != null)
{
Console.WriteLine (line);
counter++;
}
file.Close();
Namespace :
using System.IO;
Code:
string line;
// Read the file and display it line by line.
StreamReader file = new StreamReader(@"c:\test.txt");
while((line = file.ReadLine()) != null)
{
Console.WriteLine (line);
counter++;
}
file.Close();
No comments:
Post a Comment