I'm trying to read from a *txt file that a program uses as a log. I haven't found any good articles on reading from logs using C#. so i created a streamreader object and i have it read from the log.txt
well, i want to read from the log while it's being updated by another program, so i have a file systemwatcher that triggers a change event, and that event tells the streamreader to go look at the file. but I keep getting an error from the streamreader that it can't access the file since it is open by another program.
what am i doing wrong? is the streamreader the wrong object to use?
Loading
Athian MierePosted Dec 17, 2005, 7:40 PM
using ( StreamReader reader = new StreamReader(new FileStream(fileName,
FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) )