strerror()

Translate an error number into an error message.

  #include <string.h>
  
  char *strerror(int errnum);    
Parameter

errnum

The error number to translate.

Remarks

This function returns a pointer to a null-terminated character array that contains an error message that corresponds to the error code in errnum. The character strings must not be modified by the program because it may be overwritten by a subsequent calls to the strerror() function.

Typically the value in errnum will come from the global variable errno, but strerror() will provide a message translation for any value of type int.

This facility may not be available on some configurations of the EWL.

Listing: Example of strerror() Usage

#include <string.h>

#include <stdio.h>

int main(void)

{

puts(strerror(8));

puts(strerror(ESIGPARM));

return 0;

}

Output:

unknown error (8)

Signal Error