1strerror(3C) Standard C Library Functions strerror(3C)
2
3
4
6 strerror, strerror_r - get error message string
7
9 #include <string.h>
10
11 char *strerror(int errnum);
12
13
14 int strerror_r(int errnum, char *strerrbuf, size_t buflen);
15
16
18 The strerror() function maps the error number in errnum to an error
19 message string, and returns a pointer to that string. It uses the same
20 set of error messages as perror(3C). The returned string should not be
21 overwritten.
22
23
24 The strerror_r() function maps the error number in errnum to anerror
25 message string and returns the string in the buffer pointed to by str‐
26 errbuf with length buflen.
27
29 Upon successful completion, strerror() returns a pointer to the gener‐
30 ated message string. Otherwise, it sets errno and returns a pointer to
31 an error message string. It returns the string "Unknown error" if
32 errnum is not a valid error number.
33
34
35 Upon successful completion, strerror_r() returns 0. Otherwise it sets
36 errno and returns the value of errno to indicate the error. It returns
37 the string "Unknown error" in the buffer pointed to by strerrbuf if
38 errnum is not a valid error number.
39
41 These functions may fail if:
42
43 EINVAL The value of errnum is not a valid error number.
44
45
46
47 The strerror_r() function may fail if:
48
49 ERANGE The buflen argument specifies insufficient storage to contain
50 the generated message string.
51
52
54 Messages returned from these functions are in the native language spec‐
55 ified by the LC_MESSAGES locale category. See setlocale(3C).
56
58 See attributes(5) for descriptions of the following attributes:
59
60
61
62
63 ┌─────────────────────────────┬─────────────────────────────┐
64 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
65 ├─────────────────────────────┼─────────────────────────────┤
66 │Interface Stability │Standard │
67 ├─────────────────────────────┼─────────────────────────────┤
68 │MT-Level │Safe │
69 └─────────────────────────────┴─────────────────────────────┘
70
72 gettext(3C), perror(3C), setlocale(3C), attributes(5), standards(5)
73
74
75
76SunOS 5.11 31 Mar 2005 strerror(3C)