Binary IO

Glynn Clements glynn at gclements.plus.com
Fri Apr 22 16:39:35 EDT 2005


Peter Simons wrote:

>  >> hPutBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int
>  >> hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int
> 
>  > You have these in GHC.IO at the moment.
> 
> I know. ;-)
> 
> 
>  > These are also rather more difficult to implement than
>  > the single-byte versions, so I can't see nhc98 or Hugs
>  > implementing them any time soon.
> 
> What is difficult to implement about these functions? Aren't
> they just wrappers for read(2) and write(2)?

I would expect them to be essentially wrappers for fread() and
fwrite() (i.e. the stream's buffering is used), except with a single
byte-count argument instead of separate element-size and element-count
arguments.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Libraries mailing list