I'm confused a bit. I need to open a file that another program regular reads and writes. I want to make sure that I open the program in such a way that it will not harm the other programs access in any way. My program can handle any errors created by the other program changing the file out from under me - I just need to make sure that when I open the file the other program can continue to read, write, delete, etc without even knowing about my program.
FYI this is simply a weather application where the "other" program is updating a table file with current weather data - my program reads that data and sends it to another application...
Here is the code I am using:
-
Dim FS As IO.FileStream = Nothing
-
'... other code here...
-
FS = New IO.FileStream(sPath, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.ReadWrite Or IO.FileShare.Delete Or IO.FileShare.Read Or IO.FileShare.Write)
-
So my confusion is if the flags are granting the stated access to other applications, or if they are taking the access for my program. I only need to read - but somewhere along the line I believe I found that these flags are for the access levels I want to grant to other programs.
Any help would be appreciated!
Des