Determining EOF character

Chris Gonnerman chris.gonnerman at usa.net
Tue Feb 20 03:47:22 CET 2001


----- Original Message -----
From: "Grant Edwards" <grante at visi.com>
Subject: Re: Determining EOF character


> In article <slrn99334p.2fk.qrczak at qrnik.zagroda>, Marcin 'Qrczak'
Kowalczyk wrote:
> >When you press ^D on a Unix terminal, it is not sent in the stream.
> >It only flushes the line without '\n' at the end. If it was pressed
> >at the beginning of a line (or after a previous ^D), the read()
> >syscall returns 0, which is interpreted as the end of file.
>
> IIRC, it's the tty driver that interprets the ^D and generates an EOF
> condition.  The rest of Unix doesn't know ^D from your uncle Bob.

That's what he said.

So why does closing the pipe to signal EOF not work?  I've written a great
many programs
based on that.  The writer closes the pipe and terminates, and the reader
gets EOF and
continues operation.  What am I missing here?







More information about the Python-list mailing list