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

RE: What was it layers were for again ?

Thread Previous | Thread Next
From:
Moore, Paul
Date:
November 29, 2000 01:59
Subject:
RE: What was it layers were for again ?
Message ID:
714DFA46B9BBD0119CD000805FC1F53B012A83FE@UKRUX002.rundc.uk.origin-it.com
From: Bart Schuller [mailto:schuller@lunatech.com]
> 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
mid-block.

> 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,
Paul.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About