On 2006-08-19, Tim Chase <[EMAIL PROTECTED]> wrote: >>> 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:\>
IIRC, ctrl-Z is not used _in_files_ to represent EOF. Only when text is being entered at the console. > *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$ That's just the tty line-discipline layer of the tty driver. When it sees Ctrl-D as the first thing on a "line", it closes the file descriptor causing the client to see an EOF. That feature in the line-discipline layer can be disabled or configured to use any other character. I suspect what the OP really needs to do is write a newline and then flush the stream. -- Grant Edwards grante Yow! I'm pretending that at we're all watching PHIL visi.com SILVERS instead of RICARDO MONTALBAN! -- http://mail.python.org/mailman/listinfo/python-list