devxlogo

Translating errno Error Codes to Text

Translating errno Error Codes to Text

To translate an error code to its verbal description, use the function strerror(). strerror() is declared in as follows:

 char * strerror(int errcode);

The function takes an error code and returns a statically allocated char array describing that code. Remember that subsequent calls to strerror() overwrite the description string. Therefore, you should copy it to a local buffer unless you intend to use it immediately. In the following example, strerror() translates the current errno code to a string which is then printed on the user

See also  Comparing different methods of testing your Infrastructure-as-Code
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist