The problem is with Notepad that opens the file in exclusive mode when saving.
Simply put there is no (easy) way to share a file with notepad, when you open a file 
in notepad, the file contents is
read into an internal buffer and the file is closed when done. When you save the 
buffer to the file, the file is opened
in exclusive mode and the file is rewritten completely, when another process has the 
same file open with shared
read/write access, notepad fails to open the file in non-shared mode.

Willy.


----- Original Message -----
From: "Pierre Greborio" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 10, 2002 8:31 AM
Subject: [DOTNET] Open file


> Hi,
> How to open a file in a non exclusive manner ? I need to read a file
> that is edited (and saved) with notepad at the same time. The following
> construct does'n work:
>
> fs = File.Open(logFile, FileMode.Open, FileAccess.ReadWrite,
> FileShare.ReadWrite);
>
> Thank you
> Pierre
>
> -----------------------------------------------
> Pierre Greborio
> [EMAIL PROTECTED]
> http://www.pierregreborio.it
> -----------------------------------------------
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to