1PERROR(3) Library Functions Manual PERROR(3)
2
3
4
6 perror, strerror - system error messages
7
9 perror(s)
10 char *s;
11
12 #include <string.h>
13
14 char *
15 strerror(errnum)
16 int errnum;
17
19 The strerror() and perror() functions look up the error message string
20 corresponding to an error number.
21
22 The strerror() function accepts an error number argument errnum and
23 returns a pointer to the corresponding message string.
24
25 The perror() function finds the error message corresponding to the cur‐
26 rent value of the global variable errno (intro(2)) and writes it, fol‐
27 lowed by a newline, to the standard error file descriptor. If the
28 argument string is non-NULL, it is prepended to the message string and
29 separated from it by a colon and space (`: '). If string is NULL, only
30 the error message string is printed.
31
32 If errnum is not a recognized error number, the error message string
33 will contain ``Unknown error: '' followed by the error number in deci‐
34 mal.
35
36 The error messages are stored in a data file now rather than an in mem‐
37 ory array. See syserror(5).
38
40 mkerrlst(1), intro(2), psignal(3), strerror(3), syserror(3), syser‐
41 ror(5)
42
44 The strerror() function returns its result in a static buffer which may
45 be overwritten by subsequent calls.
46
47 The array sys_errlist[] and the global sys_nerr are obsolete and should
48 not be used. They have, for the time being, been placed in an object
49 library liberrlst.a.
50
51
52
534th Berkeley Distribution March 21, 1996 PERROR(3)