EOF marker
Andre W B Furtado
aw@free.elogica.com.br
Wed, 21 Feb 2001 15:37:36 -0300
This is a multi-part message in MIME format.
------=_NextPart_000_0021_01C09C1C.3754DE20
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0022_01C09C1C.3754DE20"
------=_NextPart_001_0022_01C09C1C.3754DE20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
[Sorry if you are receiving this message for the second time]
Hello there. I used the code below to read and print the bitmap file =
attached (bitmap.bmp), which cointains the character ASCII 26 (or =
1A-hexa), that is used as an end of file marker in MS-DOS:
import IO
import IOExts
main :: IO ()
main =3D do
bmFile <- openFileEx "bitmap.bmp" (BinaryMode ReadMode)
charloop bmFile 0
=20
charloop :: Handle -> Integer -> IO ()
charloop bmFile 70 =3D hClose bmFile
charloop bmFile n =3D do
hSeek bmFile AbsoluteSeek n
a <- hGetChar bmFile
putStrLn [a]
charloop bmFile (n+1)
This program did not stuck at the special character ASCII 26, but if you =
change putStrLn by putStr, a strange thing will happen: after reading =
the ASCII 26 char, the program won't show characters anymore. Does =
anyone know why this happens?
Thanks,
Andre Furtado
------=_NextPart_001_0022_01C09C1C.3754DE20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>[Sorry if you are receiving this =
message for the=20
second time]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Hello there. I used the code below to =
read and=20
print the bitmap file attached (bitmap.bmp), which cointains the =
character ASCII=20
26 (or 1A-hexa), that is used as an end of file marker in =
MS-DOS:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>import IO<BR>import IOExts</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>main :: IO ()<BR>main =3D =
do<BR> bmFile <-=20
openFileEx "bitmap.bmp" (BinaryMode ReadMode)<BR> charloop bmFile=20
0<BR> <BR>charloop :: Handle -> Integer -> IO ()<BR>charloop =
bmFile=20
70 =3D hClose bmFile<BR>charloop bmFile n =3D =
do<BR> hSeek bmFile=20
AbsoluteSeek n<BR> a <- hGetChar=20
bmFile<BR> putStrLn [a]<BR> charloop =
bmFile=20
(n+1)</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>This program did not stuck at the =
special character=20
ASCII 26, but if you change putStrLn by putStr, a strange thing will =
happen:=20
after reading the ASCII 26 char, the program won't show characters =
anymore. Does=20
anyone know why this happens?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Andre =
Furtado</FONT></DIV></BODY></HTML>
------=_NextPart_001_0022_01C09C1C.3754DE20--
------=_NextPart_000_0021_01C09C1C.3754DE20
Content-Type: image/bmp;
name="bitmap.bmp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="bitmap.bmp"
Qk1GAAAAAAAAADYAAAAoAAAAAgAAAAIAAAABABgAAAAAABAAAADEDgAAxA4AAAAAAAAAAAAAHFB3
GkxxAAAdVH4cUHcAAA==
------=_NextPart_000_0021_01C09C1C.3754DE20--