using System;
using System.IO;
namespace Text_File
{
class Class1
{
static void Main(string[] args)
{
StreamWriter sw = new StreamWriter("Test.txt");
sw.WriteLine("The First Line");
sw.WriteLine("The Second Line");
sw.WriteLine("The Third Line");
sw.Write('A');
sw.Write('B');
sw.Write('C');
sw.Write('D');
sw.Write(sw.NewLine);
sw.WriteLine("Last line");
sw.Close();
StreamReader sr = new StreamReader("Test.txt");
string s;
do
{
s = sr.ReadLine();
Console.WriteLine(s);
}
while(s != null);
Console.WriteLine("File length = {0} Bytes",sr.BaseStream.Length);
sr.Close();
}
}
}
/*
The First Line
The Second Line
The Third Line
ABCD
Last line
File length = 66 Bytes
*/