Testing if keystrokes are waiting in the buffer (solution)

Guy Harris guy at auspex.auspex.com
Sun May 6 04:19:27 AEST 1990


>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.)



More information about the Comp.lang.c mailing list