Paste Line to Notepad for a file, if it is opened by user
i am creating a logging mechanism for my program , where i have to log
data in to a file, whose location and name is specified by users.
I am doing the logging using stream writer as follows-
StreamWriter writer = Writer ?? File.AppendText(FileName);
writer.WriteLine(DateTime.Now + " " + text);
writer.Flush();
writer.Close();
But if user opens the file while my program is running , the newly logged
lines are not visible to user until the user close and reopens the file,
Is their any way i can overcome this behavior and user is also able to see
the newly logged lines when file is open.
No comments:
Post a Comment