As far as I can see, the problem is your call to hClose.
Delete it and read about semiclosed handles in the Haskell library report.

Alastair

> Version:       hugs 1.4 
> OS:            Win 95 & Win NT 4.0 
> 
> I wrote this program in file named "foo.hs"
> 
> >import IO
> >main = do hfoo <- openFile "foo.hs" ReadMode
> >          xs <- hGetContents hfoo
> >          hClose  hfoo
> >          putStr xs
> 
> I wanted it prints itself, but it shows "".
> 
> So, I changed it by adding the following line of code ...
> 
> >import IO
> >main = do hfoo <- openFile "foo.hs" ReadMode
> >          putStr xs
> >          xs <- hGetContents hfoo
> >          hClose  hfoo
> >          putStr xs
> 
> and the result was print twice copy of the program.
> 
> Moreover, I tried to re-implement the function hGetContents using hGetLine
> and the Hugs' version of hIsEof (hugsHisEOF) but I had problem with the
> last one.
> 
> I think it isn't working well. 
> I have solved my problem using the catch function and IOError, but is there
> an easy solution for this problem?
> 
> Best regards,
> 
> Pablo
> 
> 
> 
> ----------------------------------------------------------------------
>              Mocciola Pablo
>              LIFIA -  Facultad de Ciencias Exactas - UNLP          
>              50 y 115                    (1900)  La Plata
>              TE: +54 21 42738          FAX: +54 21 228252
>              Postal Address:   CC 11  
>              E-mail Address:   [EMAIL PROTECTED] 
>              http://www-lifia.info.unlp.edu.ar/~pablom
> ----------------------------------------------------------------------


Reply via email to