P
PM
Has anyone found a way to open a file exclusively where it
will fail if the file is already open, i have tried the
following
_FileStream = new FileStream(@"C:\Data.txt",
FileMode.Open, FileAccess.ReadWrite, FileShare.None);
which does not prevent me from opening the file even if
another user has the file open ie Notepad, it will prevent
me from saving the file in notepad until i close the file
in the app. I can then save changes made in notepad.
ie
Open file with notepad
Open file with app (Above line)
Clsoe file in app
Close file with changes from notepad
I want to prevent the second step so that i can only open
the file if no other process has the file open.
Thanks in advance
Pat
will fail if the file is already open, i have tried the
following
_FileStream = new FileStream(@"C:\Data.txt",
FileMode.Open, FileAccess.ReadWrite, FileShare.None);
which does not prevent me from opening the file even if
another user has the file open ie Notepad, it will prevent
me from saving the file in notepad until i close the file
in the app. I can then save changes made in notepad.
ie
Open file with notepad
Open file with app (Above line)
Clsoe file in app
Close file with changes from notepad
I want to prevent the second step so that i can only open
the file if no other process has the file open.
Thanks in advance
Pat