strerror
---convert error number to stringSynopsis
#include <string.h> char *strerror(int errnum);
Description
strerror
converts the error number errnum into a
string. The value of errnum is usually a copy of errno
.
If errnum
is not a known error number, the result points to an
empty string.
This implementation of strerror
prints out the following strings
for each of the values defined in `errno.h
':
E2BIG
EACCES
EADDRINUSE
EADV
EAFNOSUPPORT
EAGAIN
EALREADY
EBADF
EBADMSG
EBUSY
ECHILD
ECOMM
ECONNABORTED
ECONNREFUSED
EDEADLK
EDESTADDRREQ
EEXIST
EDOM
EFAULT
EFBIG
EHOSTDOWN
EHOSTUNREACH
EIDRM
EINPROGRESS
EINTR
EINVAL
EIO
EISCONN
EISDIR
ELIBACC
ELIBBAD
ELIBEXEC
ELIBMAX
ELIBSCN
.lib
section in a.out corrupted
EMFILE
EMLINK
EMSGSIZE
EMULTIHOP
ENAMETOOLONG
ENETDOWN
ENETUNREACH
ENFILE
ENODEV
ENOENT
ENOEXEC
ENOLCK
ENOLINK
ENOMEM
ENOMSG
ENONET
ENOPKG
ENOPROTOOPT
ENOSPC
ENOSR
ENOSTR
ENOSYS
ENOTBLK
ENOTCONN
ENOTDIR
ENOTEMPTY
ENOTSOCK
ENOTSUP
ENOTTY
ENXIO
EPERM
EPIPE
EPROTO
EPROTOTYPE
EPROTONOSUPPORT
ERANGE
EREMOTE
EROFS
ESHUTDOWN
ESOCKTNOSUPPORT
ESPIPE
ESRCH
ESRMNT
ETIME
ETIMEDOUT
ETXTBSY
EXDEV
Returns
This function returns a pointer to a string. Your application must
not modify that string.
Portability
ANSI C requires strerror
, but does not specify the strings used
for each error number.
Although this implementation of strerror
is reentrant, ANSI C
declares that subsequent calls to strerror
may overwrite the
result string; therefore portable code cannot depend on the reentrancy
of this subroutine.
This implementation of strerror
provides for user-defined
extensibility. errno.h
defines __ELASTERROR, which can be
used as a base for user-defined error values. If the user supplies a
routine named _user_strerror
, and errnum passed to
strerror
does not match any of the supported values,
_user_strerror
is called with errnum as its argument.
_user_strerror
takes one argument of type int, and returns a
character pointer. If errnum is unknown to _user_strerror
,
_user_strerror
returns NULL. The default _user_strerror
returns NULL for all input values.
strerror
requires no supporting OS subroutines.
Packaging copyright © 1988-2000 OAR Corporation
Context copyright by each document's author. See Free Software Foundation for information.