I have a text file which is getting updated every time from the server data .Now as per my requirement i have to read this file line by line continuously.I know how to read a file line by line but not getting how to read it continuously.Here is my c# code to read file line by line...
if (System.IO.File.Exists(FileToCopy) == true)
{
using (StreamReader reader = new StreamReader(FileToCopy))
{
string line;
string rawcdr;
while ((line = reader.ReadLine()) != null)
{
//Do Processing
}
}
}
As per my requirement i have to watch a text file continuously for changes.Suppose a new line has been added into the text file,the moment it has added it should be read by above defined code and processing should be performed as per the conditions.