[Previous]
[Contents]
[Next]

tcdrain()

wait until all output has been transmitted to a device

Synopsis:

#include <termios.h>
int tcdrain( int fildes );

Description:

The tcdrain() function waits until all output has been physically transmitted to the device associated with fildes, or until a signal is received.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

EBADF
The argument fildes is invalid.
EINTR
A signal interrupted the operation.
ENOSYS
The resource manager associated with fildes doesn't support this call.
ENOTTY
The argument fildes doesn't refer to a terminal device.

Examples:

#include <termios.h>
#include <fcntl.h>
#include <unistd.h>

void main()
  {
    int fildes;

    fildes = open( "/dev/ser1", O_RDWR );

    write( fildes, "ATH", 3 );

    /*
     * Wait for data to transmit before returning
     */
    tcdrain( fildes );

    close( fildes );
  }

Classification:

POSIX 1003.1

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

errno, write()


[Previous]
[Contents]
[Next]