bugs at iter file() ?
Wolfgang Strobl
news2 at mystrobl.de
Sat Aug 7 06:36:08 EDT 2004
"Terry Reedy" <tjreedy at udel.edu>:
>"Michael Geary" <Mike at Geary.com> wrote in message
>news:10fc6kj98mkfef4 at corp.supernews.com...
>> Terry Reedy wrote:
>> > To add to what Tim said: From the viewpoint of Windows in
>> > its default mode, there are no remaining lines. ^Z is the end
>> > of file and anything after that is accidental junk filling out the
>> > remainder of the disk block.
>>
>> Just to clarify one point... Windows itself does not have "text" or "binary"
>> files, and it does not treat ^Z in a file in any special way. There are no
>> special characters in files.
>Sorry, but ^Z has meant end-of-file I presume from the first version of
>DOS, which I suspect copied the usage from something previous.
Sorry, but Michael got it right. Windows itself does not have 'text' or
'binary' files or open modes. Have a look at CreateFile in the Platform
SDK. You won't find anythink like _TEXT or _BINARY there.
^Z is a carryover from CP/M to DOS, which, like crlf<->lf translation,
got some support in various libraries, for obvious reasons. It's not
part of the Win32 API.
>Example
>(Microsoft Basic manual, 1989): "When input is redirected [from terminal to
>a file], GW Basic continues to read from this source until a CTRL-Z is
>detected."
So what? BASICA is an application, just like bash or sendmail.
>Perhaps the usage has dimmed in non-DOS-based Windows, so that
>I should have said more carefully "from the viewpoint of DOS and perhaps
>DOS-based Windows and partially in modern non-DOS-based Windows ...".
>Still, in Windows XP, open a Command Prompt window and enter
>
>disk:\path> copy con: temp
>abd^Zdef
>
>where ^Z is control-Z and you get a file with 3, not 7 characters.
>
>The Windows version of the Python interactive interpreter exits on ^Z
>because that is, or at least was, standard behavior for interactive non-gui
>DOS/Windows programs
You mean like terminating a program using a single dot on a line is, or
at least was, standard behaviour for interactive non-gui UNIX/Linux
applications? :-)
--
Thank you for observing all safety precautions
More information about the Python-list
mailing list