[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


tcflush Subroutine

Purpose

Discards data from the specified queue.

Library

Standard C Library (libc.a)

Syntax

#include <termios.h>


int tcflush( FileDescriptor QueueSelector)
int FileDescriptor;
int QueueSelector;

Description

The tcflush subroutine discards any data written to the object referred to by the FileDescriptor parameter, or data received but not read by the object referred to by FileDescriptor, depending on the value of the QueueSelector parameter.

Parameters


FileDescriptor Specifies an open file descriptor.
QueueSelector Specifies one of the following:

TCIFLUSH
Flush data received but not read.

TCOFLUSH
Flush data written but not transmitted.

TCIOFLUSH
Flush both of the following:
  • Data received but not read
  • Data written but not transmitted

Return Values

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The tcflush subroutine is unsuccessful if one of the following is true:

EBADF The FileDescriptor parameter does not specify a valid file descriptor.
EINVAL The QueueSelector parameter does not specify a proper value.
EIO The process group of the writing process is orphaned, and the writing process does not ignore or block the SIGTTOU signal.
ENOTTY The file associated with the FileDescriptor parameter is not a terminal.

Example

To flush the output queue, enter:

rc = tcflush(2, TCOFLUSH);

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The tcdrain (tcdrain Subroutine) subroutine, tcflow (tcflow Subroutine) subroutine, tcsendbreak (tcsendbreak Subroutine) subroutine.

The Input and Output Handling Programmer's Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]