ASCII mode FTP (was RE: Fw: error)
Kenneth Brody
kenbrody at bestweb.net
Fri Jan 12 09:16:55 PST 2007
Quoting Jay R. Ashworth (Fri, 12 Jan 2007 11:29:12 -0500):
> On Thu, Jan 11, 2007 at 05:41:25PM -0800, Bob Rasmussen wrote:
> > LONG AGO it might have meant stripping a control-Z from the end of a
> DOS
> > file while converting it to a Unix file. But seriously, folks, ctrl-Z
> as
> > end-of-file has not been used since DOS 1.0, if I recall correctly! So
> > Anzio doesn't do anything about it.
>
> And, to be clear: unless my memory is seriously failing me, Ctrl-Z was
> never *supposed* to actually *be in files* -- it was the EOF character
> you *typed into the keyboard* to denote end of file to the read(1)...
> just like Ctrl-D is on a unix box. That doesn't end up in the file,
> either.
>
> Ctrl-Z's *actually in files* were the result of programmers who didn't
> understand the spec.
No, Ctrl-Z's in files were a necessity back in CP/M and MS-DOS 1.0, as
all files were multiples of 128 bytes. The only way to know where the
"real" end of a text file belonged was to pad the remaining bytes in
the file with Ctrl-Z's. Even when MS-DOS 2.0 added arbitrarily-sized
files, it was still common to append a single Ctrl-Z to the end of a
text stream.
Even today's MSVC still has special-case logic for text files that end
in Ctrl-Z. When you open a file in text mode, MSVC's runtime library
reads the last character in the file, and if it's a Ctrl-Z it will
truncate that last byte off of the file. (I ran into this one a while
back with filePro. Some legacy code within filePro would open screens
in default [text] mode, and then switch them to binary mode. This was
necessary long ago due to some limits in the DOS C compiler which
wouldn't allow us to open a shared file in binary mode -- long story,
but that description should suffice for now. If you happened to be
using bright-green-on-blue text on your filePro screens, the file
would shrink by one byte every time you accessed it -- even if you
weren't updating it in dscreen.)
--
KenBrody at BestWeb dot net spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com
More information about the Filepro-list
mailing list