Read and Write the Text file

Sakthi.Singaravel
Posted by Sakthi.Singaravel under C# category on | Points: 40 | Views : 1104
using System.IO;
static class Module1
{

public static void Main()
{
StreamWriter wr = new StreamWriter("E:\\ss.txt"); //To write
wr.WriteLine("Writing text into txt file");
wr.Close();
StreamReader reader = new StreamReader("e:\\ss.txt"); //To read
string strRead = reader.ReadToEnd();
reader.Close();
Console.WriteLine(strRead);
Console.Read();
}

}

Comments or Responses

Login to post response