Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcdrain.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcdrain.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcdrain.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcdrain.html on line 8

tcdrain()

Wait until all output has been transmitted to a device

Synopsis:

#include <termios.h>

int tcdrain( int fildes );

Arguments:

fildes
A file descriptor that's associated with the device that you want to wait for.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

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).

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>
#include <stdlib.h>

int main( void )
  {
    int fildes;

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

    /* Wait for data to transmit before returning */
    tcdrain( fildes );
    close( fildes );
    return EXIT_SUCCESS;
  }

Classification:

POSIX 1003.1

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

write()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcdrain.html on line 169

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcdrain.html on line 169