From: rwaltman AT bellatlantic DOT net (Roberto Waltman) Newsgroups: comp.os.msdos.djgpp,comp.os.cpm,alt.folklore.computers Subject: EOF char. (Was C++ and RHIDE) Date: Sun, 05 Jul 1998 19:03:41 GMT Organization: . Lines: 28 Message-ID: <35a4cd9e.28052267@news5.bellatlantic.net> References: Reply-To: rwaltman AT bellatlantic DOT net NNTP-Posting-Host: client-151-198-133-4.bellatlantic.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >Eli Zaretskii wrote: >>On 2 Jul 1998, Gili wrote: >> Call me silly, but aren't editors suppose to stop reading in >> textfiles at the EOF character? Isn't that the specification of some >> standard? >No, it's not a standard. It's a left-over from the ancient days of the >CP/M operating system (which predates DOS). Somebody wanted to avoid >accessing the file's directory entry (to know its size) when reading it. It was (is?) a standard in the CP/M world. CP/M keeps the file size as the number of 128 byte sectors that the file occupies, there isn't an exact byte count. The EOF character (CTRL-Z) is the only way a text file can be 'ended' at an arbitrary point. This convention was adopted in MS-DOS since many programs available for MS-DOS in its first few years were just ports of the CP/M versions. There are many other vestigial remains of CP/M in DOS, the "E5" character used to mark empty directory entries, (the pattern left in a disk after factory testing, by IBM?), the "program segment prefix" (a copy of the first 256 bytes of memory in CP/M, were the OS vectors and default FCBs are located,) the ".COM" file format, file control blocks and FCB related OS functions, reloading the command interpreter in high memory after letting programs overwrite part of it to gain a little extra memory, etc. RW.