[Haskell-cafe] Binary file r/w example

Cale Gibbard cgibbard at gmail.com
Wed Apr 13 08:04:30 EDT 2005


Ptr is defined in the FFI, which is documented here: 
http://www.cse.unsw.edu.au/~chak/haskell/ffi/
and also in the GHC documentation:
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Foreign.Ptr.html

I haven't done much binary IO, so I'll let someone else handle that,
but there are some libraries for doing binary IO in Haskell linked
from here:
http://www.haskell.org/hawiki/BinaryIo

 - Cale

On 4/13/05, Bo Herlin <bo at gcab.net> wrote:
> Yes, I am, and the IOExtension module IS one of my problems.
> The other problem is that I am interested in this Ptr thing, and I
> havent seen any examples in using it, and is seems like Ptr is not in
> any of my Haskell-books or in any of the tutorials that I have found.
> 
> Henning Thielemann wrote:
> >
> > On Wed, 13 Apr 2005, Bo Herlin wrote:
> >
> >> Hi, does anyone have a small but complete example on how to read a
> >> (portion of) a binary file, like r/w the header of a Midi-file?
> >>
> >> It seems like readBinaryFile (ans writeBinaryFile) is deprecated and I
> >> should use hGetBuf (and hPutBuf), but what is this Ptr thing?
> >>
> >> How would I implement readBinaryFile using hGetBuf?
> >
> >
> >
> > Are you aware of Haskore (www.haskell.org/haskore and
> > cvs.haskell.org/darcs/haskore) which provides a MidiFile reader and
> > writer? It has no good solution for reading and writing binary files,
> > but uses a platform dependent IOExtension module. :-(
> >
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list