[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io:lines() and \0
- From: Francisco Olarte <folarte@...>
- Date: Tue, 18 Feb 2014 19:25:13 +0100
On Tue, Feb 18, 2014 at 4:16 PM, Enrico Colombini <firstname.lastname@example.org> wrote:
> Another example is the "end-of-text" character (0x04 in Unix, 0x1a in
> Windows) that terminates text files.
Both Unix and Windows ( win32 & 64, and also 'modern' MSDOS which
provided files to Win16 ), have exact byte lengths in their files. ^D
/ ^Z are used by the terminal drivers to signal end of 'stream', and
are not transferred. IIRC, you can even feed them via the terminal
using some escaping.
The OS which used ^Z to signal EOF was CP/M, which stored the length
in blocks ( 128-byte blocks = sectors on the original 77 track / 26
sectors 8 inches floppies ), as it needed some way to signal the
byte-end. MSDOS files sometimes had a ^Z tucked at the end to be able
to use the same exact code as CP/M ( CP/M programs could be machine
transalated to MSDOS easily ).
But you can find much stranger things in other operating systems, as
some of them distinguishat the OS level between text and binary and
fixed / variable length, and even other quirks.