fgetc and fputc equivalents

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

fgetc and fputc equivalents

johndearle
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?

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: fgetc and fputc equivalents

Ben Franksen
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

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe