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       └────────────────────────────────────────────┴───────────────┴─────────┘
38

CONFORMING TO

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

SEE ALSO

43       fstat(2), ttyname(3)
44

COLOPHON

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