TCFLUSH(3) SysV TCFLUSH(3)
NAME
tcflush - Flush nontransmitted output data or nonread input data or both
SYNOPSIS
#include <termios.h>
int tcflush(filedes, queue_selector)
int filedes;
int queue_selector;
DESCRIPTION
The tcflush function discards any data written to the object referred to
by the filedes argument, or data received but not read by the object
referred to by filedes (an open file descriptor associated with a
terminal), depending on the value of the queue_selector argument, as
follows:
Value Action
TCIFLUSH Flush data received but not read.
TCOFLUSH Flush data written but not transmitted.
TCIOFLUSH Flush both data received but not read and data written but not
transmitted.
Attempts to use the tcflush function from a process that is a member of a
background process group on a filedes associated with its controlling
terminal cause the process group to be sent a SIGTTOU signal. If the
calling process is blocking or ignoring SIGTTOU signals, the process is
allowed to perform the operation and no signal is sent.
DIAGNOSTICS
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
tcflush function fails if:
[EBADF] The filedes argument does not specify a valid file descriptor.
[EINVAL] The queue_selector argument does not specify a proper value.
[ENOTTY] The file associated with the filedes argument is not a
terminal.
SEE ALSO
tcdrain(3), tcflow(3), tcsendbreak(3) termios(7)