The FILE object always uses \n as line delimiter, which is good for consistent behaviour across platforms (if your parse the same file with the same code on two machines you get the same result), but bad for consistent behaviour across platforms (if you run a code that reads stdin you may get different results on different machines).
So.
Newline delimiters needs to be configurable, but how should this feature work, and what is its default?
In the last episode (Sep 14), Martin Nilsson (DivX Networks) @ Pike (-) developers forum said:
The FILE object always uses \n as line delimiter, which is good for consistent behaviour across platforms (if your parse the same file with the same code on two machines you get the same result), but bad for consistent behaviour across platforms (if you run a code that reads stdin you may get different results on different machines).
So.
Newline delimiters needs to be configurable, but how should this feature work, and what is its default?
DOS/Windows handles this with the O_BINARY/O_TEXT flags, and the global variable _fmode (defaulting to O_TEXT) when the user doesn't specify a preference. Not sure how MacOS handles it. Cygwin decides based on per-mountpoint flags (defaulting to binary, since it's trying to emulate POSIX which always uses \n), and has some programs force binary mode (gzip, for example) no matter what the filesytem was mounted as. Here be tigers. :)
pike-devel@lists.lysator.liu.se