1perror(3C)               Standard C Library Functions               perror(3C)
2
3
4

NAME

6       perror, errno - print system error messages
7

SYNOPSIS

9       #include <stdio.h>
10
11       void perror(const char *s)
12
13
14       #include <errno.h>
15
16       int errno;
17
18

DESCRIPTION

20       The  perror()  function produces a message on the standard error output
21       (file descriptor 2) describing the last error encountered during a call
22       to a system or library function. The argument string s is printed, fol‐
23       lowed by a colon and a blank, followed by the  message  and  a  NEWLINE
24       character.   If  s  is  a  null pointer or points to a null string, the
25       colon is not printed. The argument string should include  the  name  of
26       the program that incurred the error. The error number is taken from the
27       external variable errno, which is set when errors occur but not cleared
28       when non-erroneous calls are made. See Intro(2).
29
30
31       In the case of multithreaded applications, the -mt option must be spec‐
32       ified on the command line at compilation time  (see  threads(5)).  When
33       the  -mt  option  is specified, errno becomes a macro that enables each
34       thread to have its own errno. This errno macro can be  used  on  either
35       side of the assignment as though it were a variable.
36

USAGE

38       Messages  printed  from this function are in the native language speci‐
39       fied by the LC_MESSAGES locale category.  See setlocale(3C).
40

ATTRIBUTES

42       See attributes(5) for descriptions of the following attributes:
43
44
45
46
47       ┌─────────────────────────────┬─────────────────────────────┐
48       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
49       ├─────────────────────────────┼─────────────────────────────┤
50       │Interface Stability          │Standard                     │
51       ├─────────────────────────────┼─────────────────────────────┤
52       │MT-Level                     │MT-Safe                      │
53       └─────────────────────────────┴─────────────────────────────┘
54

SEE ALSO

56       Intro(2),   fmtmsg(3C),   gettext(3C),   setlocale(3C),   strerror(3C),
57       attributes(5), standards(5), threads(5)
58
59
60
61SunOS 5.11                        12 Jul 2007                       perror(3C)
Impressum