tcgetattr, tcsetattr
get and set terminal attributes
- Provided by: manpages-dev (Version: 6.19-3)
- Source: manpages
- Report a bug
get and set terminal attributes
Standard C library (libc, -lc)
#include <termios.h>
int tcgetattr(int fd, struct termios *termios_p);
int tcsetattr(int fd, int optional_actions,
const struct termios *termios_p);
tcgetattr() gets the parameters associated with the object referred by fd, and stores them in the termios structure referenced by termios_p. This function may be invoked from a background process; however, the terminal attributes may be subsequently changed by a foreground process.
tcsetattr() sets the parameters associated with the terminal (unless support is required from the underlying hardware that is not available) from the termios structure referred to by termios_p. optional_actions specifies when the changes take effect:
For an explanation of the terms used in this section, see attributes(7).
| Interface | Attribute | Value |
| tcgetattr (), tcsetattr () | Thread safety | MT-Safe |
POSIX.1-2008.
POSIX.1-2001.
tcsetattr() returns success if any of the requested changes could be successfully carried out. Therefore, when making multiple changes, it may be necessary to follow this call with a further call to tcgetattr() to check that all changes have been performed successfully.