feof status (was: Re: [Python-Dev] Rehabilitating fgets)
Eric S. Raymond
esr@thyrsus.com
Sat, 6 Jan 2001 23:01:25 -0500
Tim Peters <tim_one@email.msn.com>:
> > [Tim suggests to use fgets(), preparing the buffer with non-null
> > bytes, and searching for a null byte from the right.]
No, I haven't forgotten about the curses autoconfig stuff. But...
This mess reminds me. For some work I'm doing right now, it would be
very useful if there were a way to query the end-of-file status of a
file descriptor without actually doing a read.
I don't see this ability anywhere in the 2.0 API. Questions:
1. Am I missing something obvious?
2. If the answer to 1 is that I am not, in fact, being a dumbass, what
is the right way to support this? The obvious alternatives are an
eof member (analogous to the existing `closed' member, or an eof()
method. I favor the latter.
3. If we agree on a design, I'm willing to implement this at least for
Unix. Should be a small project.
--
<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>
The direct use of physical force is so poor a solution to the problem of
limited resources that it is commonly employed only by small children and
great nations.
-- David Friedman