I just tried this example with putStrLn and putStr, and both worked
fine. I am using the latest 4.08.2 GHC under Windows 2000.
-----Original Message-----
From: Andre W B Furtado [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 6:20 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: putStr vs. putStrLn
Hello there. I used the code below to read and print the bitmap file
attached (bitmap.bmp), which contains the character ASCII 26 (or
1A-hexa). This special character is used by MSDOS as an end of file
marker.
import IO
import IOExts
main :: IO ()
main = do
bmFile <- openFileEx "bitmap.bmp" (BinaryMode ReadMode)
charloop bmFile 0
charloop :: Handle -> Integer -> IO ()
charloop bmFile 70 = hClose bmFile
charloop bmFile n = do
hSeek bmFile AbsoluteSeek n
a <- hGetChar bmFile
putStrLn [a]
charloop bmFile (n+1)
This program did not stuck after reading the special character, but if
you change putStrLn by putStr you will notice that a strange thing
happens: after reading the special character, the program won't show any
more characters. Why does it happen?
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell