A problem about hGetContents
Nick Name
nick.name@inwind.it
Sun, 19 Jan 2003 18:34:30 +0100
On Sun, 19 Jan 2003 17:19:52 +0000
Glynn Clements <glynn.clements@virgin.net> wrote:
>=20
>=20
> Just omit the hClose; hGetContents will automatically close the
> handle once all of the data has actually been read. See =A711.2.1 of
> the library report for details.
Thanks for this pointer. Quoting from the report:
A semi-closed handle becomes closed:
* if hClose is applied to it;
* if an I/O error occurs when reading an item from the file item
from the stream;
* or once the entire contents of the file has been read.=20
What happens if one does NOT read the whole contents, but there are no
more references to the results of hGetContents? Is the file handle
closed anyway ? Here's an example of what I mean:
openFile n ReadMode >>=3D hGetContents >>=3D return . (take 10)
Vincenzo
--=20
First they ignore you, then they laugh at you,
then they fight you, then you win.
[Gandhi]