[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unexpected result using file:read("l")
- From: Francisco Olarte <folarte@...>
- Date: Thu, 24 Mar 2022 16:09:49 +0100
On Thu, 24 Mar 2022 at 15:35, Flyer31 Test <flyer31@googlemail.com> wrote:
> How should "poor Lua" know, whether you are running it on a Windows
> (by MS standard using \r\n) or a Linux system (by standard using \n).
It does not need to. It just assumes if the programmer asks to trat a
file as text he knows what he is doing.
> ... on of the "nerving inventions of MS" I always thought ... but if
> Mac has the same problem ... :(.
It is not really from microsoft, CP/M already had it an others before.
It comes from when you used teletypes (tty), which were just autmated
typewriters. To send text to the printing part you need to send a
command to return the carriage to the left margin and another one to
advance the paper ( and some may remember, in old, unbuffered printers
you needed to insert a short wait after a line feed and a longer one
after carriage return ( and another one after from feed, whch advanced
a whole page ) to give the hardware time to move things around ( this
was way before things like dot matrix printers with line buffers ).
The invention is more from Unix, which noticed you did not need two
characters for storing text, and you could easily translate it when
sending to the printer.
Francisco Olarte.