[Haskell-cafe] (no subject)

Tillmann Rendel rendel at rbg.informatik.tu-darmstadt.de
Thu May 24 06:10:53 EDT 2007


Hello,

Ketil Malde wrote:
> Makes me wonder whether one should have binary be the default?  I'm a
> stranger in Windows-land, but are there cases where you want reading
> of a file to be terminated on ^Z?  Seems pretty awful to me.

The ghc docs state about openBinaryFile:

> Like openFile, but open the file in binary mode. On Windows, reading
> a file in text mode (which is the default) will translate CRLF to LF,
> and writing will translate LF to CRLF. [...] text mode treats control-Z as EOF

The CRLF-to-LF translation is the more important part. It allows '\n' to 
stand for the end of a line on windows, too, even if lines are 
terminated by two characters in windows text files.

   Tillmann


More information about the Haskell-Cafe mailing list