[Haskell-cafe] Data.Binary Endianness

Bryan O'Sullivan bos at serpentine.com
Mon Sep 10 13:37:28 EDT 2007

Adrian Neumann wrote:

> For example, the internet states, that the magic number, that puts 'BM'
> in the first two bytes of the file is 19778. But when I
>> put (19778::Word16)
> I get 'MB' instead.

Just use putWord16le instead.  There exist endian-specific versions of 
all of the word-level get and put functions.


More information about the Haskell-Cafe mailing list