Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Testing if keystrokes are waiting in the buffer (solution) Keywords: kbhit, UNIX, keypressed Message-ID: <3306@auspex.auspex.com> Date: 5 May 90 18:19:27 GMT References: <1990Apr25.000456.25048@cunixf.cc.columbia.edu> <24107@mimsy.umd.edu> <684@n4hgf.uucp> Organization: Auspex Systems, Santa Clara Lines: 9 >XENIX V, SCO UNIX, UNIX Sys V Rel 4: > if(rdchk(0)) /* if ICANON is on, rdchk will report nothing until > * newline or whatever is typed */ The same, or equivalent, is true of FIONREAD as well; it reports how many characters are ready to be read, and the line you're typing in "cooked mode" isn't ready to be read until you type newline or whatever. (It does, however, include typeahead, of course.)