The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


tcgetattr - get the parameters associated with the terminal


#include <termios.h>

int tcgetattr(int fildes, struct termios *termios_p);


The tcgetattr() function gets the parameters associated with the terminal referred to by fildes and stores them in the termios structure referenced by termios_p. The fildes argument is an open file descriptor associated with a terminal.

The termios_p argument is a pointer to a termios structure.

The tcgetattr() operation is allowed from any process.

If the terminal device supports different input and output baud rates, the baud rates stored in the termios structure returned by tcgetattr() reflect the actual baud rates, even if they are equal. If differing baud rates are not supported, the rate returned as the output baud rate is the actual baud rate.  If the terminal device does not support split baud rates, the input baud rate stored in the termios structure will be 0.


Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.


The tcgetattr() function will fail if:
The fildes argument is not a valid file descriptor.
The file associated with fildes is not a terminal.






In a future issue of this document, implementations which do not support differing baud rates will be prohibited from returning 0 as the input baud rate.


tcsetattr(), <termios.h>, the XBD specification, General Terminal Interface .


Derived from the POSIX.1-1988 standard.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]