Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
strerror - get message string
&pagelevel(4)&pagelevel
Syntax | #include <string.h> char *strerror(int errnum); |
Description | strerror() maps the error number in errnum to a locale-dependent message string and returns a pointer to that string (see section “Error handling”). The returned string must not be modified by the program, but may be overwritten by a subsequent call to
strerror() or popen() .
The contents of the message strings returned by strerror() should be determined by the setting of the LC_MESSAGES category in the current locale. A complete listing of error numbers and error messages as well as explanations can be found under the header
errno.h . |
Return val. | Pointer to a message string |
| if successful. |
Null pointer | if an error occurs. errno is set to indicate the error. |
Errors | strerror() will fail if:
|
| EINVAL
| The value of errnum is not a valid error number. |
Notes | Since no return value is reserved to indicate an error, an application wishing to check for error situations should set errno to 0, then call strerror() , then check errno , and if it is not equal to 0, assume that an error has occurred. The message text can also contain inserts: If the error number passed in the errnum parameter matches the current error number, inserts are taken into account and added to the error message text. The current error number is the one stored in the errno variable. Otherwise, a message text is returned without inserts, that matches the error number passed in errnum.
|
See also | perror() , popen() , errno.h , string.h , section “Error handling”.
|