Check input buffer in C

Doug Gwyn gwyn at smoke.BRL.MIL
Sun May 27 14:48:50 AEST 1990


In article <1990May26.144958.4395 at aucs.uucp> 852028e at aucs.UUCP (Amari  M.  Elammari) writes:
> Is there a UNIX C (sun4 C) function that checks if the input buffer 
> is empty???
>What I want to do is to check the buffer, if there are some
>characters in the buffer then read them; otherwise continue
>with the next statement.

To which "input buffer" do you refer?  There are several different
kinds of "input buffer" possible for a UNIX C program.  If your
program maintains its own buffer, it should be able to test it;
the stdio buffer is not worth testing, because of the way stdio
uses it; kernel disk block buffers are also not worth testing;
streams can be tested with select() or poll(); under some
circumstances the terminal handler MIN & TIME parameters might be
appropriate.



More information about the Comp.unix.questions mailing list