The word "flush" comes from the Middle English "flusshen", meaning
"to take wing" or "to fly up suddenly". (Birds do this in groups
when startled.) This meaning persists today in the phrase "flush
out": things that are hidden can be flushed, chased out of their
concealment for all to see. This is what fflush() does.
Flushing an input buffer, then, would expose its contents to
view -- which is not really all that useful.
I suspect what is really wanted is more like a "purge". The BSDs
have an fpurge() function that does this (for both input AND output,
since it has sensible applications in both cases).
You're sitting at the keyboard, firing in commands to do this, that, the
other thing. In the process, you inadvertently enter some option which
is potentially dangerous... but you're still merrily typing away, while
the potentially dangerous program is figuring out what to do - you're
queuing up your inputs.
The program, realizing that what you asked for is dangerous, puts up a
prompt "Do you really mean this? y/N" and waits for input. However, since
you've already queued up inputs, it may well see an N (or worse, a Y)
and the results range from annoying to disastrous.
'Course, if the program had flushed input,
(presumably you mean "purged" input
-- but we might simply
redefine "flush" to mean "discard", except when it applies to
output, which is not discarded at all...)
your queued commands would be
lost... but you wouldn't be feeding an unwanted input into the program at
a critical juncture.
There is a technical problem here (with a technical but currently
unimplementable solution). Suppose you are sitting at the keyboard
in Australia, typing into the machine located in Vancouver BC, over
a lossy or satellite-based Internet connection with huge latency.
You are "firing in commands" at time T, T+1, T+2, T+3, and so on,
but the transmission to the remote system is rather "lumpy" so that
they arrive there at time T+2, T+6, T+6, T+6, T+9, T+11, T+11, and
so on.
The "dangerous" operation occurs at time T+5 and arrives at the
remote system at time T+9. By then, of course, even more input is
queued at the source (Australia).
Meanwhile, the program prints "do you really mean this" at T+9 and
tries to purge typeahead. The message "do you really mean this"
arrives in Australia at T+11 or so. What input is discarded?
The problem is that the input, output, and flush/purge/whateveryoucallit
operations are not synchronized -- and without some sort of embedded
timing information (or external protocol), they cannot even *be*
synchronized. So fpurge(), while useful, is still quite limited.