[Haskell-beginners] Unformatted binary IO

David Raymond raymond at kestrel.nmt.edu
Mon Sep 29 15:52:43 UTC 2014


I am trying to read and write to/from files or stdout/stdin that have
an ascii header followed by unformatted float32 binary data.  (The
files are created using a C program.)  The ascii header first needs to
be parsed to understand the structure of the floating point data.  I
have solved the parsing problem, but getting the unformatted binary
float data into a series of float (or double) immutable, unboxed
vectors has defeated me so far.  The binary package doesn't help as
far as I can see, as the binary format it reads and writes has some
control information at the beginning that doesn't exist in the format
I am reading.

This is easy in C, but seems to be hard in Haskell unless I am missing
something.

Any suggestions?

-- 
David J. Raymond
Prof. of Physics
New Mexico Tech
http://www.physics.nmt.edu/~raymond/index.html


More information about the Beginners mailing list