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

개요

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

newlocale(3c)

Standard C Library Functions                                     newlocale(3C)



NAME
       newlocale - create or modify a locale object

SYNOPSIS
       #include <locale.h>
       locale_t newlocale(int category_mask, const char *locale, locale_t base);

DESCRIPTION
       The  newlocale()  function  creates  a new locale object or modifies an
       existing one. If the base argument is (locale_t)0, a new locale  object
       is  created.  It is unspecified whether the locale object pointed to by
       base is modified, or freed and a new locale object created.


       The category_mask argument specifies the locale categories to be set or
       modified.  Values  for category_mask shall be constructed by a bitwise-
       inclusive OR of the symbolic constants LC_CTYPE_MASK,  LC_NUMERIC_MASK,
       LC_TIME_MASK,  LC_COLLATE_MASK, LC_MONETARY_MASK, and LC_MESSAGES_MASK.
       Alternatively, the mask can  be  specified  as  LC_ALL_MASK,  which  is
       equivalent to ORing all of the preceding constants.


       For  each  category with the corresponding bit set in category_mask the
       data from the locale named by locale is used. In the case of  modifying
       an  existing  locale  object,  the data from the locale named by locale
       replaces the existing data within the locale object.  If  a  completely
       new  locale  object is created, the data for all sections not requested
       by category_mask is taken from the default locale.


       The following preset values of locale are defined for all  settings  of
       category_mask:


       "POSIX"    Specifies the minimal environment for C-language translation
                  called the POSIX locale.


       "C"        Equivalent to POSIX.


       ""         Specifies an implementation-defined native environment. This
                  corresponds to the value of the associated environment vari‐
                  ables, LC_* and LANG.




       If the base argument is not (locale_t)0 and  the  newlocale()  function
       call succeeds, the contents of base are unspecified. Applications shall
       ensure that they stop using base as  a  locale  object  before  calling
       newlocale().  If  the  function call fails and the base argument is not
       (locale_t)0, the contents of base remain valid and unchanged.


       The behavior is undefined if the base argument is  the  special  locale
       object  LC_GLOBAL_LOCALE, or is not a valid locale object handle and is
       not (locale_t)0.

RETURN VALUES
       Upon successful completion, the newlocale() function returns  a  handle
       which  the  caller  may use on subsequent calls to duplocale(), freelo‐
       cale(), and other functions taking a locale_t argument.


       Upon failure, the newlocale()  function  returns  (locale_t)0  and  set
       errno to indicate the error.

ERRORS
       The newlocale() function will fail if:


       [ENOMEM]    There  is  not enough memory available to create the locale
                   object or load the locale data.


       [EINVAL]    The category_mask contains a bit that does  not  correspond
                   to  a  valid category or the locale argument is not a valid
                   string pointer.


       [ENOENT]    For any of the categories in category_mask, the locale data
                   is not available.



USAGE
       Handles  for locale objects returned by the newlocale() function should
       either be released by a corresponding call to freelocale(), or be  used
       as a base locale to another newlocale() call.


       The  special  locale object LC_GLOBAL_LOCALE must not be passed for the
       base argument, even when returned by the uselocale() function.

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-LevelMT-Safe _ Stan‐
       dardSee standards(7)


SEE ALSO
       duplocale(3C),  freelocale(3C),  uselocale(3C),  attributes(7),   stan‐
       dards(7)



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