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

Technical Reference: Base Operating System and Extensions, Volume 2

tcdrain Subroutine


Waits for output to complete.


Standard C Library (libc.a)


#include <termios.h>

int tcdrain( FileDescriptor)
int FileDescriptor;


The tcdrain subroutine waits until all output written to the object referred to by the FileDescriptor parameter has been transmitted.


FileDescriptor Specifies an open file descriptor.

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 tcdrain subroutine is unsuccessful if one of the following is true:

EBADF The FileDescriptor parameter does not specify a valid file descriptor.
EINTR A signal interrupted the tcdrain subroutine.
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.


To wait until all output has been transmitted, enter:

rc = tcdrain(stdout);

Related Information

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

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

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