![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| tcsendbreak | 
| 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
duration
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 | 
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.