Re: Problem reading files...

2001-02-12 Thread andrew


Are you on a Windows platform of some kind (I guess so, from your mail
headers)?  I vaguely remember having a problem like this (in Python,
IIRC) because MSDOS used ^Z (ASCII 26) as an end of file marker.  So
low-level Win32 file access routines still interpret this character as
end-of-file.  I got round the problem at the time by using binary i/o.
I don't know whether this is possible in Haskell.

Andrew

On Mon, Feb 12, 2001 at 05:09:18PM -0300, Andre W B Furtado wrote:
> Hello there. I was trying to read a bitmap file using hGetChar but I had a 
>problem: if the file contains the byte 26-decimal (or 1A-hexa)  the program aborts. 
>Here you have the output:
> 
> Fail: end of file
> Action: hGetChar
> 
> Since hGetChar is implemented with getc, I created a similar program in C, using 
>getc. This program written in C had no problems. Is this a haskell bug or does anyone 
>know what's going on?
> 
> Thanks,
> Andre Furtado

-- 
http://www.andrewcooke.free-online.co.uk/index.html

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



Re: Problem reading files...

2001-02-12 Thread Sven Panne

> Andre W B Furtado wrote:
> [ EOF at Ctrl-Z problem ]

Sounds like you're using WinDoze which interprets Ctrl-Z as EOF in
non-binary files IIRC (great idea, BTW! :-}. Alas, you have to use
non-standard features (openFileEx or hSetBinaryMode) to get around
this, see:

   http://www.haskell.org/ghc/docs/latest/set/sec-ioexts.html#AEN8657

Cheers,
   Sven

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell



Problem reading files...

2001-02-12 Thread Andre W B Furtado



    Hello there. I was trying to 
read a bitmap file using hGetChar but I had a problem: if the file contains the 
byte 26-decimal (or 1A-hexa)  the program aborts. Here you have the 
output:
 
Fail: end of file
Action: hGetChar
 
    Since hGetChar is implemented 
with getc, I created a similar program in C, using getc. This program written in 
C had no problems. Is this a haskell bug or does anyone know what's going 
on?
 
Thanks,
Andre Furtado