Gets terminal state.
Standard C Library (libc.a)
int tcgetattr (FileDescriptor, TermiosPointer) int FileDescriptor; struct termios *TermiosPointer;
The tcgetattr subroutine gets the parameters associated with the object referred to by the FileDescriptor parameter and stores them in the termios structure referenced by the TermiosPointer parameter. This subroutine is allowed from a background process; however, the terminal attributes may subsequently be changed by a foreground process.
Whether or not the terminal device supports differing input and output baud rates, the baud rates stored in the termios structure returned by the tcgetattr subroutine reflect the actual baud rates, even if they are equal.
Note: If differing baud rates are not supported, returning a value of 0 as the input baud rate is obsolete.
|FileDescriptor||Specifies an open file descriptor.|
|TermiosPointer||Points to a termios structure.|
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The tcgetattr subroutine is unsuccessful if one of the following is true:
|EBADF||The FileDescriptor parameter does not specify a valid file descriptor.|
|ENOTTY||The file associated with the FileDescriptor parameter is not a terminal.|
To get the current terminal state information, enter:
rc = tcgetattr(stdout, &my_termios);
This subroutine is part of Base Operating System (BOS) Runtime.
The tcsetattr subroutine.
The Input and Output Handling Programmer's Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.