CONTENTS | INDEX | PREV | NEXT

 strerror

   NAME
    strerror - return error string associated with error code

   SYNOPSIS
    const char *str = strerror(error);
    int error;

   FUNCTION
    strerror returns a read-only string associated with the specified
    error, usually taken from errno after some c.lib call fails.

    An unknown error will result in the string "unknown error"

   EXAMPLE
    #include <stdio.h>
    #include <errno.h>
    #include <assert.h>

    main()
    {
        FILE *fi;

        fi = fopen("ThisFileDoesNotExist", "r");
        assert(fi == NULL);
        puts(strerror(errno));

        return(0);
    }

   INPUTS
    int error;  error code

   RESULTS
    char *str;  error string

   SEE ALSO