> I can't seem to work around this behaviour, is it possible to
> force readFile to just open a file, read it entirely and close it
> before doing the next open ? I tried a few things with seq,
> but this doesn't work:
>
> xs <- mapM (\x -> let y = readFile x
> in seq y y) (take 1000 (repeat "tmp"));
>
> and neither does this:
>
> let
> f = mapM (\x -> let y = readFile x
> in seq y y) (take 1000 (repeat "tmp"));
> in do {
> xs <- seq f f;
> return ();
> }
hGetLine is strict, in that it keeps reading until a newline or EOF is
found. Repeated hGetLine can be used to read the entire file.
Alternatively you could use IOExts.hGetBuf and friends to slurp the data
into a buffer and then convert the buffer into a string with one of the
CString.unpackNBytes family.
Cheers,
Simon
- RE: openFile, process file table full Marko Schuetz
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- RE: openFile, process file table full Simon Marlow
- RE: openFile, process file table full Simon Marlow
- Re: openFile, process file table full George Russell
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- Re: openFile, process file table full Jan Kort
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- Re: openFile, process file table full Ch. A. Herrmann
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- Re: openFile, process file table full Simon Marlow
- Re: openFile, process file table full Jan Kort
- RE: openFile, process file table full Josef Svenningsson
