The impl for this kind of stuff is already in there:
hFillBufBA :: Handle - ByteArray Int - Int - IO Int
hPutBufBA :: Handle - ByteArray Int - Int - IO ()
hFillBuf :: Handle - Addr - Int - IO Int
hPutBuf:: Handle - Addr - Int - IO ()
all available from PrelHandle.
Yes,
Hello!
On Fri, Mar 10, 2000 at 01:42:01AM -0800, Simon Marlow wrote:
[...]
hPutBufBA :: Handle - ByteArray Int - Int - IO ()
hPutBuf:: Handle - Addr - Int - IO ()
[...]
Why are the output functions of return type IO () and not also
IO Int (or rather IO [some integral type large
Hello!
On Fri, Mar 10, 2000 at 02:52:41AM -0800, Simon Marlow wrote:
[...]
The idea is that the functions never return until the whole buffer is
written. If the reading end (of a socket or pipe) is closed prematurely,
we'll get an IO error.
But even in the IO error, it'd be interesting
| But Haskell *really* needs some standard way of reading values in the
| native format on a platform:
What about this specification?
hReadByteArray :: Handle - MutableByteArray a - Int - IO Int
-- Read the specified number of *bytes* into the byte array.
-- Return the
Simon Peyton-Jones wrote:
What about this specification?
hReadByteArray :: Handle - MutableByteArray a - Int - IO Int
[...]
hWriteByteArray :: Handle - MutableByteArray a - Int - IO ()
[...]
Both may block.
Would that do what you want? If so we can add it to IOExts.
i'd like to read a byte stream from stdin.
the stream contains 0xFF now and then.
i fear that such a byte is treated as EOF by ghc,
because processing seems to stop right after it first occured.
do you know a workaround?
in case you're asking - i'm trying to implement the GMP (go modem
Johannes Waldmann wrote:
i'd like to read a byte stream from stdin. the stream contains 0xFF
now and then. i fear that such a byte is treated as EOF by ghc,
because processing seems to stop right after it first occured.
Hmmm, I've never experienced something like this. The following code
Hi,
if you're using ghc under Win32, this is expected behaviour
(and is there because of backwards compatibility with CP/M -
see http://support.microsoft.com/support/kb/articles/Q68/4/23.asp
for more info.)
The fix is to open your file in BinaryMode using
IOExts.openFileEx :: FilePath -