Strange problems with binary file output: result of incorrect
simonmar at microsoft.com
Wed Jun 16 04:31:28 EDT 2004
On 16 June 2004 01:07, Mike Aizatsky wrote:
> Sorry it was clearly my fault. I was quite sure I'm using the
> openBinaryFile, while I was using openFile. Turned out after several
> more hours of tough debugging.
> BTW, wouldn't it be better if there were text/binary output functions
> instead of text/binary files? It makes sense to output strings in text
> mode, but arrays of Word8 in binary mode (my case). It looks at least
> strange, that while writing the array with 0xA the values are written
> as 0xD 0xA (text conversion).
This is one of the weak areas of the current IO library. There have
been some efforts to redesign things, but nothing substantial yet. Text
translation on Windows is just one case of text encoding/decoding
between Strings in Haskell and external files, and we want to solve this
problem in a general way.
More information about the Glasgow-haskell-bugs