develooper Front page | perl.perl5.porters | Postings from November 2000

RE: What was it layers were for again ?

Thread Previous | Thread Next
Moore, Paul
November 29, 2000 01:59
RE: What was it layers were for again ?
Message ID:
From: Bart Schuller []
> I'd love to hear from people/programs who actually use this "feature".
> And wasn't it really DOS or even an ancestor of that that 
> used it last?

Get rid of it! While CRLF conversion is (unfortunately) necessary,
terminating the file at ^Z is not. It's a remnant of CP/M, where file sizes
were reported in terms of disk blocks, even if the file itself ended

> Are there functions in the Win32 API that will write a ^Z in textmode?

The Win32 API itself treats all files as binary, believe it or not... It's
only the C runtime layer which does textmode/binmode distinctions. Ideally
Win32 could go all-binmode, just like Unix, but the use of CRLF in text
files is too entrenched to easily ignore.

Basically, textmode is a "portability" hack to allow Unix code (which sees
line ends as \n) to run unchanged in an environment where lines are ended
differently. However, more and more Unix systems are being exposed to files
in DOS (and other) text formats (via Samba shares, network protocols which
mandate CRLF, and the like).

Strangely, if more Unix-derived programs were to address the CRLF issue
directly, rather than relying on the stdio layer, there would be less need
for textmode emulation in the stdio layer on Windows, and there would be
more chance of it going away (as if!).

Philosophically yours,

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About