Commit 354f17ec authored by simonpj's avatar simonpj
Browse files

[project @ 2002-03-08 15:42:12 by simonpj]

Read and write interfaces in binary mode; important for Win32
parent 87d802b9
......@@ -220,7 +220,7 @@ isEOFBin (BinIO _ ix_r h) = hIsEOF h
writeBinMem :: BinHandle -> FilePath -> IO ()
writeBinMem (BinIO _ _ _) _ = error "Data.Binary.writeBinMem: not a memory handle"
writeBinMem (BinMem _ ix_r sz_r arr_r) fn = do
h <- openFile fn WriteMode
h <- openFileEx fn (BinaryMode WriteMode)
arr <- readIORef arr_r
ix <- readFastMutInt ix_r
hPutArray h arr ix
......@@ -234,7 +234,7 @@ writeBinMem (BinMem _ ix_r sz_r arr_r) fn = do
readBinMem :: FilePath -> IO BinHandle
readBinMem filename = do
h <- openFile filename ReadMode
h <- openFileEx filename (BinaryMode ReadMode)
filesize' <- hFileSize h
let filesize = fromIntegral filesize'
arr <- newArray_ (0,filesize-1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment