F
Frank Rizzo
I am trying to open a file in exclusive mode for writing. Is the code
below correct?
FileStream oStream = File.Open(FileName, FileMode.Open,
FileAccess.Write, FileShare.None);
The purpose is two-fold:
1. I want no one to be able to open a file while I am operating on it.
2. If the file is open by someone else, I want the code above to throw
an exception.
Will it do the trick?
Thanks.
below correct?
FileStream oStream = File.Open(FileName, FileMode.Open,
FileAccess.Write, FileShare.None);
The purpose is two-fold:
1. I want no one to be able to open a file while I am operating on it.
2. If the file is open by someone else, I want the code above to throw
an exception.
Will it do the trick?
Thanks.