Jump to: navigation, search


The strerror() function maps the number in errnum to a message string. Typically, the values for errnum come from errno, but strerror() shall map any value of type int to a message.

Return value

The strerror() function returns a pointer to the string, the contents of which are locale- specifi�c. The array pointed to shall not be modifi�ed by the program, but may be overwritten by a subsequent call to the strerror() function.


Declared in string.h

The C89/C99 prototype is:

char *strerror(int errnum);


In standard C, this can be implemented as:

char *strerror(int errnum)
        That is actually interpreting the standard by the letter, not intent.
        We only know about the "C" locale, no more. That's the only mandatory locale anyway.
    return errnum ? "There was an error, but I didn't crash yet!" : "No error.";

Compilable unit, portable C90 in implementation namespace; public domain; past reviewers: none; current reviews: none


The C Standard, (C99 numbering)

Personal tools
Personal tools
not logged in