Chapter Contents

Previous

Next
tcsendbreak

tcsendbreak



Send a Break Condition

Portability: POSIX.1 conforming


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS


SYNOPSIS

#include <termios.h>

int tcsendbreak(int fileDescriptor, int duration); 


DESCRIPTION

tcsendbreak sends a break condition to a terminal.

fileDescriptor
is a file discriptor that refers to an asynchronous communications line.

duration
controls the duration of the break condition in an implementation-defined way. See the POSIX.1 standard for details.

Under OS/390 USS, all terminals are pseudoterminals. The tcsendbreak function has no effect on pseudoterminals.


RETURN VALUE

tcsendbreak returns a 0 if successful and a -1 if unsuccessful. If tcsendbreak is called from a background process, with a file descriptor that refers to the controlling terminal for the process, a SIGTTOU signal may be generated. This will cause the function call to be unsuccessful, returning a -1 and setting errno to EINTR . If SIGTTOU is blocked, the function call proceeds normally.


EXAMPLE

The following example illustrates the use of tcsendbreak to transmit a break condition to stdout :

#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

main()
{
   int ttyDevice = STDOUT_FILENO;
   int time = 15;
   char * lineOut = "Break transmitted to terminal.";

      /* Wait for all data transmission to the terminal to finish */
      /* and then transmit a break condition to the terminal.     */
   if (tcdrain(ttyDevice) != 0) {
      perror("tcdrain error");
      return(EXIT_FAILURE);
   }
   else {
      if (tcsendbreak(STDOUT_FILENO, time) != 0) {
         perror("tcdsendbreak error");
         return(EXIT_FAILURE);
      }
      else
         write(ttyDevice, lineOut, strlen(lineOut) + 1);
   }
   return(EXIT_SUCCESS);
}


RELATED FUNCTIONS

tcflow


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.