[Haskell-cafe] windows file locking
Esa Ilari Vuokko
eivuokko at gmail.com
Wed Oct 11 06:13:49 EDT 2006
On 10/11/06, Stefan Aeschbacher <haskell at aeschbacher.ch> wrote:
> I need to open a file and keep it open for writing (a log file). Another
> process has
> to read from this file. On windows the second process (e.g. tail -f) can not
> open the file.
> How can I open a file without this locking?
Using base-package's IO-system, that is not possible as far as I know.
The flag you need to pass CreateFile (api call which is used to open
practically all files) is FILE_SHARE_READ.
You can find these in Win32-package, but files opened via raw api
bindings don't work well together with base-packages IO-system (ie,
you need to read and write using rawish api calls.)
More information about the Haskell-Cafe