strerror

From Wikipedia, the free encyclopedia

C Standard Library headers

The string-error function, strerror, is a C/C++ function which translates an error code, usually stored in the global variable errno, to a human-readable error message.

Contents

[edit] History

The strerror function is defined in IEEE Std 1003.1, also known as POSIX 1.

[edit] Reentrancy

The strerror function is not reentrant. For a reentrant version of the function, see strerror_r.

[edit] Usage

[edit] Inclusion

C
#include <string.h>
C++
#include <cstring>

[edit] Declaration

char* strerror(int errnum);

[edit] Semantics

The function generates and reports a C-style string, containing an error message derived from the error code passed in with errnum.

[edit] See Also

[edit] References

  1. strerror by OpenGroup