How can I read keyboard without stopping
Chris Torek
chris at mimsy.UUCP
Wed Aug 31 09:59:40 AEST 1988
>In article <1267 at ficc.UUCP> peter at ficc.UUCP (Peter da Silva) writes:
>>... Wouldn't it make sense to have stat() on a terminal device return
>>the number of characters available?
In article <669 at super.ORG> rminnich at super.ORG (Ronald G Minnich) writes:
>You would think so, wouldn't you.
Perhaps. I doubt one could make much use of it, since it would change
from moment to moment, as the user types.
>Also, on most unix's you can't tell whether there are 0 bytes
>to read because of an eof or 0 bytes cause nothing is there yet.
False (except perhaps on SysV, where read on a non-blocking descriptor
returns 0 instead of -1).
>I haven't looked lately to see if such a thing has been added; on 4.2-like
>systems you had to to shenanigans with select() and FIONREAD to determine
>that you were at EOF.
Again, false. The only odd thing about EOF on a terminal is that it is
not `sticky', since it is (usually) caused by a human agent and not
something reliable :-) .
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.wizards
mailing list