[Haskell-cafe] Re: fgetc and fputc equivalents

Ben Franksen ben.franksen at online.de
Wed Dec 9 14:56:55 EST 2009


John D. Earle wrote:
> Although much work has apparently gone into providing support for
> manipulation binary data I was unable to uncover a Haskell equivalent of
> the C fgetc and fputc functions. The Haskell equivalents work with Unicode
> character streams, not bytes words etcetera. I did find a library for
> handling arrays of bytes and such, but I did not find it to be convenient
> for the application I have in mind. I resolved myself to emitted Unicode
> 0s and 1s that are later converted to binary 0s and 1s by means of a C
> program. Is this functionality missing in Haskell? or did I miss
> something?

It is not in the Standard, but (at least) GHC has hPutBuf and hGetBuf (see
http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html).

Cheers
Ben



More information about the Haskell-Cafe mailing list