strerror -- Map Error Number to a Message String

SYNOPSIS

 #include <string.h>

 char *strerror(int errnum);
 

DESCRIPTION

strerror maps the error number in errnum to an error message string.

The message returned by strerror provides much less information than the library-generated message for an error. For instance, the result of strerror(ERANGE) is "math function value out of bounds," while the library message for this error includes the name and arguments of the failing function.

RETURN VALUE

The return value is a pointer to a message describing the error number.

EXAMPLE

  #include <stdio.h>
  #include <string.h>
  #include <errno.h>
  #include <lclib.h>

  main()
  {
     FILE *f;
     char *filename;

     quiet(1);    /* Suppress library messages. */

     f = fopen(filename, "w");

        /* Provide error message if open fails. */
     if (!f) printf ("Open failed. %sn", strerror(errno));
  }

 

RELATED FUNCTIONS

perror

SEE ALSO


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.