You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
768 B
C#

/*
* C# Program to Perform Text Operations in a File
*/
using System;
using System.IO;
class Program
{
static void Main()
{
FileInfo finfo = new FileInfo("C:\\sri\\srip.txt");
using (StreamWriter writer = finfo.AppendText())
{
writer.WriteLine("New File with various Text operations");
}
finfo = new FileInfo("C:\\sri\\srip.txt");
using (StreamWriter writer = finfo.CreateText())
{
writer.WriteLine("New File with various Text operations");
}
using (StreamReader reader = finfo.OpenText())
{
Console.WriteLine(reader.ReadToEnd());
}
Console.Read();
}
}
/*
New File with various Text operations