strerror function(Convert Error Number to String) in C Language – example and detail

In the C Programming Language, the strerror characteristic returns a pointer to a string that consists of an error message for a given errnum.

Syntax

The syntax for the strerror function in the C Language is:

char *strerror(int errnum);

Parameters or Arguments

errnum An error quantity that you want to retrieve the error message for.

Returns

The strerror function returns a pointer to a string that contains an error message for a unique errnum.

Required Header

In the C Language, the required header for the strerror feature is:

#include <string.h>

Applies To

In the C Language, the strerror function can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the strerror function:

perror function <stdio.h>