Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

intro(2)

catgets(3)

catopen(3)

perror(3)

setlocale(3)

strerror(3)  —  Subroutines

NAME

strerror, strerror_r − Access message explaining function error

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <string.h>

char ∗strerror(
int errnum);

int strerror_r(
int errnum,
char ∗strerrbuf,
int buflen);

PARAMETERS

errnumSpecifies an error-number value. 

strerrbufSpecifies a buffer that will hold the error message. 

buflenSpecifies the length of the buffer. 

DESCRIPTION

The strerror() function maps the error number specified by the errnum parameter to a error message string and returns a pointer to the string.  The string pointed to by the return value is not modified by the program, but may be overwritten by a subsequent call to this function.  The implementation behaves as though no other function calls the strerror() function. 

If a library message catalog is available for the current locale, the strerror() function stores the message from that catalog. Otherwise, it uses the default messages. The LC_MESSAGES category in the setlocale() call specifies the message catalog language, and the NLSPATH environment variable specifies the directory search path for message catalogs. 

The strerror_r() function is the reentrant version of the strerror() function.  On successful completion, the error message is returned in strerrbuf. 

NOTES

AES Support Level:
Full use (strerror()). 

RETURN VALUES

On successful completion, the strerror() function returns a pointer to the generated message string.  If the error number is not valid, errno is set to [EINVAL]. 

On successful completion, the strerror_r() function returns a value of 0 (zero); otherwise, a value of -1 is returned. 

ERRORS

If the following condition occurs, these functions set errno to the corresponding value. 

[EINVAL]The errnum parameter is an invalid error number or, in the strerror_r() function, the strerrorbuf is inaccessible.  Note that the strerror_r() function truncates the error message if strerrbuf is too small. 

RELATED INFORMATION

Functions: intro(2), catgets(3), catopen(3), perror(3), setlocale(3). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026