Glynn Clements wrote:
[...]
main :: IO ()
main = do
h <- openBinaryFile "out.dat" WriteMode
hPutStr h $ map (octetToChar . bitsToOctet) bits
hClose h
Hmmm, using string I/O when one really wants to do binary I/O gives me a bad
feeling. Haskell characters are defined to be Unicode characters, so the
above only works because current Haskell implementations usually get this wrong
(either no Unicode support at all and/or ignoring any encodings and doing I/O
only with the lower 8 bits of the characters)... hGetBuf/hPutBuf plus their
non-blocking variants are the only way to *really* do binary I/O currently.
Cheers,
S.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe