Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

tcflush - discard non-transmitted data

&pagelevel(4)&pagelevel

Syntax

#include <termios.h>

int tcflush(int fildes, int queue_selector); 

Description

fildes is a file descriptor associated with a terminal. Upon successful completion, tcflush() discards data that was written to the object referred to by fildes but not transmitted, or data that was received but not read, depending on the value of queue_selector:

If queue_selector is TCIFLUSH, data that was received but not read is flushed; if queue_selector is TCOFLUSH, data that was written but not transmitted is flushed, and if queue_selector is TCIOFLUSH, both the data that was received but not read and the data that was written but not transmitted are flushed.

Attempts to use tcflush() from a process which is a member of a background process group on a fildes associated with its controlling terminal, will 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 SIGTTOU signal is sent.

Extension
All values are supported for connections with a remote processor. (End)

Return val.

0

-1

if successful.

if an error occurs. errno is set to indicate the error.

Errors

tcflush() will fail if:

 

EBADF

fildes is not a valid file descriptor.

 

EINVAL

queue_selector is not a supported value.

 

Extension

 

EINVAL

An attempt was made to access a BS2000 file. (End)

 

EIO

The process group of the writing process is orphaned, and the writing process is not ignoring or blocking SIGTTOU.

 

ENOTTY

The file associated with fildes is not a terminal.

Notes

tcflush() has no effect on block-mode terminals.

See also

tcdrain(), termios.h, unistd.h, section “General terminal interface”.