Colin
Tue Nov 29 21:27:21 CST 2005
I understand my problem better now. When another process has a lock on the
file, I would like to wait until the lock is released and then do my append.
How can I do this?
Thanks,
Colin.
"Truong Hong Thi" <thi1981@gmail.com> wrote in message
news:1133240514.903637.185110@z14g2000cwz.googlegroups.com...
Hi Colin,
By default, if you open a file for writting, it is locked and not
others cannot write to the same file until you close it. It you also
don't want others to read, you could pass FileShare.None to the
constructor of FileStream.
FileStream stream = new FileStream(name, FileMode.Append,
FileAccess.Write, FileShare.None);
StreamWriter w = new StreamWriter(stream);
Regards,
Thi -
http://thith.blogspot.com