[Haskell-cafe] (no subject)
Ketil Malde
ketil at ii.uib.no
Thu May 24 05:31:59 EDT 2007
On Thu, 2007-05-24 at 17:01 +0800, L.Guo wrote:
> Tring openBinaryFile,
Well, did you get it to work?
> I can not locate which module including readBinaryFile.
This is what I find in System.IO (ghci> :b System.IO):
openBinaryFile :: FilePath -> IOMode -> IO Handle
openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle)
hSetBinaryMode :: Handle -> Bool -> IO ()
so you have the option of either using openBinaryFile or openFile and
using hSetBinaryMode to true. I guess - I've never had to use them.
I can't find a readBinaryFile either, but writing one might be a good
excercise?
Makes me wonder whether one should have binary be the default? I'm a
stranger in Windows-land, but are there cases where you want reading of
a file to be terminated on ^Z? Seems pretty awful to me.
Concerning mutable buffers, it is of course possible, but hardly
idiomatic Haskell. Why do you need mutability?
-k
More information about the Haskell-Cafe
mailing list