![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| tcflow | 
| Portability: | POSIX.1 conforming | 
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| EXAMPLE | |
| RELATED FUNCTIONS | 
| SYNOPSIS | 
#include <termios.h> int tcflow(int fileDescriptor, int action);
| DESCRIPTION | 
tcflow
 controls the flow of data to and from a terminal device. Because
USS OS/390 supports only pseudo-terminals, 
tcflow
 affects only the flow of data between the OMVS TSO command and
user programs.  It does not directly affect transmission to and from a user's
3270 terminal.
The arguments to 
tcflow
 are:
fileDescriptor
action
tcflow
. The values
for 
action
 are defined
in 
<termios.h>
 and can
be any of the following:
TCOOFF
 | 
suspends output to the terminal. | 
TCOON
 | 
restarts suspended output to a terminal. | 
TCIOFF
 | 
transmits a 
STOP
 character to a terminal. This should stop
further transmission of data from the terminal. | 
TCION
 | 
transmits a 
START
 character to a terminal. This should restart
the transmission of data from the terminal. | 
If 
tcflow
 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
. If 
SIGTTOU
 is
blocked, the function call proceeds normally. 
| RETURN VALUE | 
tcflow
 returns a 
0
if successful and a 
-1
if unsuccessful.
| EXAMPLE | 
The following example illustrates the
use of 
tcflow
 to suspend
data transmission: 
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
   int ttyDevice = STDOUT_FILENO;
   /* Make sure file descriptor is for a TTY device,               */
   if ( ! isatty(ttyDevice) ) {
      printf("Not a TTY device.n");
      return(EXIT_FAILURE);
   }
      /* Suspend and resume data transmission,                        */
   else {
      printf("About to suspend data transmission for 5 seconds.n");
      if (tcflow(ttyDevice, TCOOFF) != 0) {
         perror("tcflow error");
         exit(EXIT_FAILURE);
      }
      sleep(5);
      if (tcflow(ttyDevice, TCOON) == 0)
         printf("Data transmisiion suspended and resumed.n");
      else {  /* We turned it off, and now we can't turn it back on!  */
         perror("tcflow error");  /* probably message will be lost    */
         abort();
   }
   return(EXIT_SUCCESS);
}
| RELATED FUNCTIONS | 
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.