write eof without closing
Tim Chase
python.list at tim.thechases.com
Sat Aug 19 11:39:14 EDT 2006
>> can i write a eof to a file descriptor without closing it?
>
> No. Not on Windows, OS-X, or Unix. There is no such thing as
> "an eof".
>
> On CP/M Ctrl-Z is used as EOF for text files.
Common Dos/Window convention also uses ctrl+Z (0x1a) for EOF.
c:\> copy con test.txt
hello
^Z
c:\>
*nix usually uses ctrl+D (0x04) as an EOF signal...and OS-X being
Unixish also uses the same.
bash$ cat > test.txt
hello
^D
bash$
Don't know about Macs earlier than OS-X.
I don't know if there are problems (triggering an actual EOF and
closing the file) writing either of these ascii characters in
ascii/text mode (may vary between platforms?), but there are no
problems writing either of these characters in binary mode.
-tkc
More information about the Python-list
mailing list