F
Flash Gordon
Bartc wrote, On 07/12/08 13:19:
That is a bad design choice for the language. After all, it means it
does not follow the conventions of the system it is running on unless
that happens to be DOS/Windows (well, anything using that convention,
but not any of the many other systems).
Another argument for why the design of that language was bad.
It is probably "seen" otherwise, at least by the OS, just not so visible
to the average user.
I would say it was a problem with the design of the other language. Had
the other language either followed the same convention that C does (as
many languages do) or implemented its own library (as others do) then it
would not be a problem. In any case, I don't think stdout was really
provided for binary output, it was (I think) provided to provide the
main textual output to the user of the program (via whatever mechanism
such output might arrive, be it email from a cron job, output on a
telytype or whatever).
I've just remembered the reason: I was calling C's printf() from a language
that expanded "\n" to CR,LF actually in the string literal.
That is a bad design choice for the language. After all, it means it
does not follow the conventions of the system it is running on unless
that happens to be DOS/Windows (well, anything using that convention,
but not any of the many other systems).
Because printf writes to stdout and stdout is in text mode, the LF results
in an extra expansion.
Another argument for why the design of that language was bad.
But the CR,CR,LF is only seen when directed to a
file.
It is probably "seen" otherwise, at least by the OS, just not so visible
to the average user.
So not a C problem other than stdout being awkward to set to binary mode.
I would say it was a problem with the design of the other language. Had
the other language either followed the same convention that C does (as
many languages do) or implemented its own library (as others do) then it
would not be a problem. In any case, I don't think stdout was really
provided for binary output, it was (I think) provided to provide the
main textual output to the user of the program (via whatever mechanism
such output might arrive, be it email from a cron job, output on a
telytype or whatever).