_strerror
Remonter à string.h - Index
Header File
string.h, stdio.h
Category
Memory and String Manipulation Routines
Prototype
char *_strerror(const char *s);
Description
Builds a customized error message.
_strerror lets you generate customized error messages; it returns a pointer to a null-terminated string containing an error message.
- If s is null, the return value points to the most recent error message.
- If s is not null, the return value contains s (your customized error message), a colon, a space, the most-recently generated system error message, and a new line. s should be 94 characters or less.
Return Value
_strerror returns a pointer to a constructed error string. The error message string is constructed in a static buffer that is overwritten with each call to _strerror.
Example
#include <stdio.h>
#include <errno.h>
int main(void)
{
char *buffer;
buffer = strerror(errno);
printf("Error: %s\n", buffer);
return 0;
}
Portability
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |