strerror(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

strerror(3c)

Standard C Library Functions                                      strerror(3C)



NAME
       strerror, strerror_l, strerror_r - get error message string

SYNOPSIS
       #include <string.h>

       char *strerror(int errnum);


       char *strerror_l(int errnum, locale_t locale);


       int strerror_r(int errnum, char *strerrbuf, size_t  buflen);

DESCRIPTION
       The  strerror()  function  maps the error number in errnum to a locale-
       dependent error message string determined by the setting of the LC_MES‐
       SAGES  category  in  the  current locale, and returns a pointer to that
       string. It uses the same set of error messages as perror(3C).


       The application shall not modify  the  string  returned.  The  returned
       string  pointer  might  be  invalidated  or the string content might be
       overwritten by a subsequent call to strerror(), or by a subsequent call
       to strerror_l() in the same thread.


       Since  no  return value is reserved to indicate an error of strerror(),
       an application wishing to check for error situations should  set  errno
       to 0, then call strerror(), then check errno.


       The  strerror_l() function maps the error number in errnum to a locale-
       dependent error message string in the locale represented by locale, and
       returns  a  pointer  to that string. It uses the same set of error mes‐
       sages as perror(3C). The returned string should not be overwritten.


       Since strerror_l() is required to return a string for some  errors,  an
       application  wishing to check for all error situations should set errno
       to 0, then call strerror_l(), then check errno.


       The behavior is undefined if the <locale> argument to  strerror_l()  is
       the  special  locale  object  LC_GLOBAL_LOCALE or is not a valid locale
       object handle.


       The strerror_r() function maps the error number in errnum to  an  error
       message  string and returns the string in the buffer pointed to by str‐
       errbuf with length buflen.

RETURN VALUES
       Upon  successful  completion,  strerror()  and  strerror_l()  return  a
       pointer  to  the generated message string. Otherwise, it sets errno and
       returns a pointer to an error message string.  It  returns  the  string
       "Unknown error" if errnum is not a valid error number.


       Upon  successful  completion, strerror_r() returns 0. Otherwise it sets
       errno and returns the value of errno to indicate the error. It  returns
       the  string  "Unknown  error"  in the buffer pointed to by strerrbuf if
       errnum is not a valid error number.

ERRORS
       These functions may fail if:

       EINVAL    The value of errnum is not a valid error number.



       The strerror_r() function may fail if:

       ERANGE    The buflen argument specifies insufficient storage to contain
                 the generated message string.


USAGE
       Messages returned from these functions are in the native language spec‐
       ified by the LC_MESSAGES locale category. See setlocale(3C).

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe _ Standard‐
       See standards(7).


SEE ALSO
       duplocale(3C), freelocale(3C), gettext(3C), newlocale(3C),  perror(3C),
       setlocale(3C), uselocale(3C), attributes(7), standards(7)



Oracle Solaris 11.4               10 Oct 2014                     strerror(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3