Home
menubar
rss_feed

Previous Reference C++ Reference <cstring> Next Reference




C++ Reference: strerror()





strerror()


Declaration

char* strerror(int iErrorNumber);

Description

This function returns a pointer to a string containing the error message corresponding to the error number given by "iErrorNumber."

Example

#include <cstdio>
#include <cstring>

int main()
{
    // Output the first 10 error messages
    for (int iIndex = 0; iIndex < 10; ++iIndex) {
        char* cpErrorMsg = strerror(iIndex);
        printf("Error number %i is %s\n", iIndex, cpErrorMsg);
    }
    return 0;
}


Output:








Previous Reference C++ Reference <cstring> Next Reference




Home | Reference | Play Games! | Blog | Forum | Site Map | Contact Us


shadow bottom image