1ISATTY(3)                  Linux Programmer's Manual                 ISATTY(3)
2
3
4

NAME

6       isatty - test whether a file descriptor refers to a terminal
7

SYNOPSIS

9       #include <unistd.h>
10
11       int isatty(int fd);
12

DESCRIPTION

14       The  isatty()  function tests whether fd is an open file descriptor re‐
15       ferring to a terminal.
16

RETURN VALUE

18       isatty() returns 1 if fd is an open file descriptor referring to a ter‐
19       minal; otherwise 0 is returned, and errno is set to indicate the error.
20

ERRORS

22       EBADF  fd is not a valid file descriptor.
23
24       ENOTTY fd  refers  to a file other than a terminal.  On some older ker‐
25              nels, some types of files resulted in the error EINVAL  in  this
26              case  (which  is a violation of POSIX, which specifies the error
27              ENOTTY).
28

ATTRIBUTES

30       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
31       tributes(7).
32
33       ┌──────────┬───────────────┬─────────┐
34Interface Attribute     Value   
35       ├──────────┼───────────────┼─────────┤
36isatty()  │ Thread safety │ MT-Safe │
37       └──────────┴───────────────┴─────────┘

CONFORMING TO

39       POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
40

SEE ALSO

42       fstat(2), ttyname(3)
43

COLOPHON

45       This  page  is  part of release 5.10 of the Linux man-pages project.  A
46       description of the project, information about reporting bugs,  and  the
47       latest     version     of     this    page,    can    be    found    at
48       https://www.kernel.org/doc/man-pages/.
49
50
51
52Linux                             2019-03-06                         ISATTY(3)
Impressum