strerror

Maps an error number to an error message

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:String Manipulation

Syntax

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

Parameters

errnum
(IN) Specifies the error number to be mapped to an error message.

Return Values

The strerror function returns a pointer to the error message. The array containing the error string should not be modified by the program. This array can be overwritten by a subsequent call to the strerror function.

Remarks

The strerror function maps the error number contained in errnum to an error message.

See Also

perror

Example

  #include <string.h>  
  #include <errno.h>  
   
  main ()  
  {  
     FILE    *fp;  
     fp = fopen ("file.nam", "r");  
     if (fp == NULL)  
        printf ("Unable to open file: %s\n", strerror (errno) );  
  }