[Haskell-cafe] (no subject)

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu May 24 04:59:09 EDT 2007


marco-oweber:
> On Thu, May 24, 2007 at 02:38:05PM +0800, L.Guo wrote:
> > Thanks for your suggestion, and sorry for the subject.
> > 
> > I have read the introduction of Data.ByteString, it is helpful.
> > 
> > And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF.
> 
> You have to use readBinaryFile instead of readFile.
> I had the same trouble as well.
> 
> I finally implemented accessing single characters in C and did use ffi
> because I didn't know haw to do this i haskell properly. ( using
> peek/poke functions 4 bytes got written (wihch is annotateted somewhere
> ) If you are interested I can sent you the modified ByteString package.
> 
> If someone can tell me which haskell function to use to set a random
> char in a memory buffer I would be pleased ..

    'poke'

or else use unboxed Word8 arrays

Check the src for Data.ByteString for examples.


More information about the Haskell-Cafe mailing list