.TH tcgetattr() "" "" "termios Macro (termios.h)"
.PC "Get terminal attributes"
.B "#include <termios.h>"
\fBint tcgetattr (\fIfd\^\fB, \fItermios_p\^\fB);\fR
\fBint fd\^\fB;\fR
struct termios *termios_p;
.PP
The
.B termios
macro
.B tcgetattr()
gets the parameters for the terminal device described by file descriptor
.IR fd ,
and stores them in the
.B termios
structure to which
.I termios_p
points.
.PP
.B ttcgetattr()
can be called from a background process.
Please note, however, a foreground process can subsequently change
the terminal device's attributes, which renders obsolete the information in
.IR termios_p .
.PP
If all goes well,
.B tcgetattr()
returns zero.
If a problem occurs, it returns \-1 and sets
.B errno
to an appropriate value, as follows:
.IP \fBEBADF\fR
.I fd
is not a valid file descriptor.
.IP \fBENOTTY\fR
.I fd
does not describe a terminal device.
.SH "See Also"
.Xr "tcsetattr()," tcsetattr
.Xr "termios" termios
.br
\*(PX Standard, \(sc7.2.1
