[Haskell-cafe] File I/O question
bjorn at bringert.net
Thu Mar 13 05:42:34 EDT 2008
On Wed, Mar 12, 2008 at 10:03 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> Don Stewart wrote:
> > Hey Andrew,
> > What are you trying to do? Read and write to the same file (if so, you
> > need to use strict IO), or are you trying something sneakier?
> I have a long-running Haskell program that writes status information to
> a log file. I'd like to be able to open and read that log file before
> the program has actually terminated. I have a similar program written in
> Tcl that allows me to do this, since apparently the Tcl interpretter
> doesn't lock output files for exclusive access. Haskell, however, does.
> (This seems to be the stipulated behaviour as per the Report.) If
> there's an easy way to change this, it would be useful...
How about using appendFile?
"appendFile :: FilePath -> String -> IO ()
The computation appendFile file str function appends the string str,
to the file file."
More information about the Haskell-Cafe