[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl and Alpha, "Illegal character \012" SOLVED!



This is getting really off topic, but I can tell you why DOS uses a CR/LF
to denote end of line rather than just one character as MacOS and UNIX do:
teletype printers. You see, a 300 baud teletype receives characters pretty
much as fast as it can print them. Also, it takes roughly the same amount
of time for two characters to show up as it does for the teletype to
advance the roll and return the print head to the start position.
Therefore, 2 characters a CR (to return the print head) and a LF (to
advance the roller) were sent so characters would not be lost in the
message. A lot of the output of early computers was aimed at these teletype
machines, and I've worked on programs that still send output to them in the
'90s.

I believe that the guys who wrote Q-DOS (and even Bill Gates) got their
start programming for output on these machines, but I could be mistaken.

I don't know if there is any reason why one character was chosen over the
other in the MacOS and UNIX worlds, but if you ask me all three
possibilities make sense. It would be nice if we could get every OS to
agree on a single choice, though.

Oh yeah, while we're on this subject....In Codewarrior, it depends on which
mode you're writing to a file for what character is sent by '\n'. If you're
using the Standard C library and in ASCII mode, a CR is written to a file,
even if you explicitly write '\0x0A'. I know, I've tried. You have to be in
binary mode to get a LF in a file, or a CR/LF. Of course, you don't have
this problem using MacOS Toolbox calls. I haven't tried writing '\r' to a
file with Codewarrior, but I'll have to give it a shot sometime to see what
it actually puts in there.

If I'm not mistaken, MacPerl writes a CR for '\n'.

Anyway, I now return you to your regularly scheduled discussions.

>On Sat, 24 Oct 1998 12:12:53 -0400, Chris Nandor wrote:
>
>>I am sure that if we could go back in time and slap Steve and Steve around,
>>we could have had them use \012 as newline in the beginning, but I don't
>>think that is going to happen.
>
>It's not just computers.
>
>Traditionally, printers had enough on just a chr(13), that is, a CR. The
>Mac stuck to that tradition. It's Unix that broke with it.
>
>I think superstition has a something to do with this. Maybe the number
>13 was chosen, because the return key is as important as a control
>character can get: you can't get around it. And in Unix, they might have
>picked 10 instead of 13, when given the choice between the two, for
>exactly the same reason. "Oh no, not 13!". Such is life. :-)
>
>Anybody knows a source to back this up?
>
>	Bart.
>
>***** Want to unsubscribe from this list?
>***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch

+----------------------------+-----------------------------+
|     Jason Stephenson       |        panda@mis.net        |
+----------------------------+-----------------------------+
| There are no guarantees in life, the Tao or programming. |
|                      --Bruce Eckel                       |
+----------------------------------------------------------+

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch