strerror
Go Up to string.h Index
Header File
string.h
Category
Memory and String Manipulation Routines
Prototype
char *strerror(int errnum);
Description
Returns a pointer to an error message string.
strerror takes an int parameter errnum, an error number, and returns a pointer to an error message string associated with errnum.
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++ |
---|---|---|---|
+ | + | + | + |