Is there a unicode EOF mark like DOS ascii ctl-z or unix crl-d ?

Michael Geary Mike at DeleteThis.Geary.com
Mon Sep 8 03:44:34 EDT 2003


Martin v. Löwis wrote:
> No, there is no need to have one (neither is there a need to have one
> for plain ASCII files): The end-of-file is when the file ends. Most
> operating systems support a notion of a "file size", and the file ends
> when file-size bytes have been consumed.
>
> Why Microsoft decided to use ctr-z in text files is beyond me, it does
> not fulfil any useful function...

It came from CP/M, which believe it or not had *no* way to specify an exact
file length. File lengths were measured in sectors, not bytes. So there had
to be some way to tell where a text file ended, and CP/M used Ctrl+Z.

MS-DOS picked up this convention, although if memory serves it always had
exact file lengths even in version 1.0.

Nobody uses Ctrl+Z in Windows/DOS text files any more, although I think the
COPY command still respects it if you use the /A switch or concatenate
files.

-Mike






More information about the Python-list mailing list