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

개요

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

localeconv(3c)

localeconv(3C)           Standard C Library Functions           localeconv(3C)

NAME
       localeconv - get numeric formatting information

SYNOPSIS
       #include <locale.h>

       struct lconv *localeconv(void);

DESCRIPTION
       The  localeconv()  function  sets the components of an object with type
       struct lconv (defined in <locale.h>) with the  values  appropriate  for
       the formatting of numeric quantities (monetary and otherwise) according
       to  the rules of the current locale (see setlocale(3C)). The definition
       of struct lconv is given below (the values for the fields  in  the  "C"
       locale are given in comments).

         char *decimal_point;        /* "." */
         char *thousands_sep;        /* "" (zero length string) */
         char *grouping;             /* "" */
         char *int_curr_symbol;      /* "" */
         char *currency_symbol;      /* "" */
         char *mon_decimal_point;    /* "" */
         char *mon_thousands_sep;    /* "" */
         char *mon_grouping;         /* "" */
         char *positive_sign;        /* "" */
         char *negative_sign;        /* "" */
         char int_frac_digits;       /* CHAR_MAX */
         char frac_digits;           /* CHAR_MAX */
         char p_cs_precedes;         /* CHAR_MAX */
         char p_sep_by_space;        /* CHAR_MAX */
         char n_cs_precedes;         /* CHAR_MAX */
         char n_sep_by_space;        /* CHAR_MAX */
         char p_sign_posn;           /* CHAR_MAX */
         char n_sign_posn;           /* CHAR_MAX */



       The  following  members are also available to SUSv3-conforming applica‐
       tions. See standards(7)

         char int_p_cs_precedes;     /* CHAR_MAX */
         char int_p_sep_by_space;    /* CHAR_MAX */
         char int_n_cs_precedes;     /* CHAR_MAX */
         char int_n_sep_by_space;    /* CHAR_MAX */
         char int_p_sign_posn;       /* CHAR_MAX */
         char int_n_sign_posn;       /* CHAR_MAX */



       The members of the structure with type char * are strings, any of which
       (except decimal_point) can point to a null  string  (""),  to  indicate
       that  the  value  is  not available in the current locale or is of zero
       length. The members with type char are  non-negative  numbers,  any  of
       which  can  be  CHAR_MAX (defined in the <limits.h> header) to indicate
       that the value is not available in the current locale. The members  are
       the following:

       char *decimal_point        The  decimal-point  character used to format
                                  non-monetary quantities.


       char *thousands_sep        The character used  to  separate  groups  of
                                  digits  to  the  left  of  the decimal-point
                                  character in formatted non-monetary  quanti‐
                                  ties.


       char *grouping             A  string  whose  elements taken as one-byte
                                  integer values indicate  the  size  of  each
                                  group  of  digits  in formatted non-monetary
                                  quantities.


       char *int_curr_symbol      The international currency symbol applicable
                                  to the current locale. The first three char‐
                                  acters contain the alphabetic  international
                                  currency  symbol  in  accordance  with those
                                  specified in the ISO  4217:  1995  standard.
                                  The  fourth character (immediately preceding
                                  the null byte) is the character used to sep‐
                                  arate the international currency symbol from
                                  the monetary quantity.


       char *currency_symbol      The local currency symbol applicable to  the
                                  current locale.


       char *mon_decimal_point    The  decimal  point  used to format monetary
                                  quantities.


       char *mon_thousands_sep    The separator for groups of  digits  to  the
                                  left of the decimal point in formatted mone‐
                                  tary quantities.


       char *mon_grouping         A  string  whose  elements taken as one-byte
                                  integer values indicate  the  size  of  each
                                  group  of digits in formatted monetary quan‐
                                  tities.


       char *positive_sign        The string used to indicate a  non-negative-
                                  valued formatted monetary quantity.


       char *negative_sign        The  string used to indicate a negative-val‐
                                  ued formatted monetary quantity.


       char int_frac_digits       The number of fractional  digits  (those  to
                                  the  right  of the decimal point) to be dis‐
                                  played in an internationally formatted mone‐
                                  tary quantity.


       char frac_digits           The number of fractional  digits  (those  to
                                  the  right  of the decimal point) to be dis‐
                                  played in a formatted monetary quantity.


       char p_cs_precedes         Set to 1 or 0 if the currency_symbol respec‐
                                  tively precedes or succeeds the value for  a
                                  non-negative formatted monetary quantity.


       char p_sep_by_space        Set  to  0  if  no  space separates the cur‐
                                  rency_symbol  or  int_curr_symbol  from  the
                                  value  for a non-negative formatted monetary
                                  quantity. Set to 1 if a space separates  the
                                  symbol  from  the  value;  and set to 2 if a
                                  space separates  the  symbol  and  the  sign
                                  string, if adjacent.


       char n_cs_precedes         Set to 1 or 0 if the currency_symbol respec‐
                                  tively  precedes or succeeds the value for a
                                  negative formatted monetary quantity.


       char n_sep_by_space        Set to 0 if  no  space  separates  the  cur‐
                                  rency_symbol  or  int_curr_symbol  from  the
                                  value  for  a  negative  formatted  monetary
                                  quantity.  Set to 1 if a space separates the
                                  symbol from the value; and set  to  2  if  a
                                  space  separates  the  symbol  and  the sign
                                  string, if adjacent.


       char p_sign_posn           Set to a value indicating the positioning of
                                  the positive_sign for a non-negative format‐
                                  ted monetary quantity.


       char n_sign_posn           Set to a value indicating the positioning of
                                  the negative_sign for a  negative  formatted
                                  monetary quantity.


       char int_p_cs_precedes     Set to 1 or 0 if the int_curr_symbol respec‐
                                  tively  precedes or succeeds the value for a
                                  non-negative internationally formatted mone‐
                                  tary quantity.


       char int_n_cs_precedes     Set to 1 or 0 if the int_curr_symbol respec‐
                                  tively precedes or succeeds the value for  a
                                  negative  internationally formatted monetary
                                  quantity.


       char int_p_sep_by_space    Set to a value indicating the separation  of
                                  the  int_curr_symbol,  the  sign string, and
                                  the value for a non-negative internationally
                                  formatted monetary quantity.


       char int_n_sep_by_space    Set to a value indicating the separation  of
                                  the  int_curr_symbol,  the  sign string, and
                                  the value  for  a  negative  internationally
                                  formatted monetary quantity.


       char int_p_sign_posn       Set to a value indicating the positioning of
                                  the  positive_sign for a non-negative inter‐
                                  nationally formatted monetary quantity.


       char int_n_sign_posn       Set to a value indicating the positioning of
                                  the negative_sign for  a  negative  interna‐
                                  tionally formatted monetary quantity.



       The  elements of grouping and mon_grouping are interpreted according to
       the following:

       {CHAR_MAX}    No further grouping is to be performed.


       0             The previous element is to be repeatedly used for the re‐
                     mainder of the digits.


       other         The integer value is the number of digits  that  comprise
                     the current group. The next element is examined to deter‐
                     mine the size of the next group of digits before the cur‐
                     rent group.



       The  values  of p_sep_by_space, n_sep_by_space, int_p_sep_by_space, and
       int_n_sep_by_space are interpreted according to the following:

       0    No space separates the currency symbol and value.


       1    If the currency symbol and sign string are adjacent, a space sepa‐
            rates them from the value; otherwise, a space separates  the  cur‐
            rency symbol from the value.


       2    If the currency symbol and sign string are adjacent, a space sepa‐
            rates  them; otherwise, a space separates the sign string from the
            value.



       In  an  SUSv3-conforming  application,   for   int_p_sep_by_space   and
       int_n_sep_by_space, the fourth character of int_curr_symbol is used in‐
       stead of a space.


       The   values   of   p_sign_posn,   n_sign_posn,   int_p_sign_posn,  and
       int_n_sign_posn are interpreted according to the following:

       0    Parentheses  surround  the   quantity   and   currency_symbol   or
            int_curr_symbol.


       1    The  sign  string  precedes  the  quantity  and currency_symbol or
            int_curr_symbol.


       2    The sign string  succeeds  the  quantity  and  currency_symbol  or
            int_curr_symbol.


       3    The  sign  string  immediately  precedes  the  currency_symbol  or
            int_curr_symbol.


       4    The  sign  string  immediately  succeeds  the  currency_symbol  or
            int_curr_symbol.


RETURN VALUES
       The  localeconv()  function  returns a pointer to the filled-in object.
       The structure pointed to by the return value may be  overwritten  by  a
       subsequent call to localeconv().

EXAMPLES
       Example 1 Rules used by four countries to format monetary quantities.



       The  following  table  illustrates  the rules used by four countries to
       format monetary quantities.


       tab() box; lw(NaNi) |lw(NaNi) |lw(NaNi)  |lw(NaNi)  lw(NaNi)  |lw(NaNi)
       |lw(NaNi)   |lw(NaNi)   CountryPositiveNegativeInternational   _  Italy
       (IT)L.1.234-L.1.234ITL.1.234 _ Netherlands (NE)F 1.234,56F −1.234,56NLG
       1.234,56 _ Norway (NO)kr1.234,56kr1.234,56−NOK 1.234,56  _  Switzerland
       (SW)SFrs.1,234.56SFrs.1,234.56CCHF 1,234.56




       For  these  four countries, the respective values for the monetary mem‐
       bers of the structure returned by localeconv() are as follows:


       tab() box; lw(NaNi) |lw(NaNi) |lw(NaNi)  |lw(NaNi)  |lw(NaNi)  lw(NaNi)
       |lw(NaNi)   |lw(NaNi)  |lw(NaNi)  |lw(NaNi)  ITNENOSW  _  int_curr_sym‐
       bol"ITL.""NLG ""NOK  ""CHF  "  _  currency_symbol"L.""F""kr""SFrs."   _
       mon_decimal_point""","",""."     _    mon_thousands_sep"."".""."","   _
       mon_grouping"\3""\3""\3""\3"   _    positive_sign""""""""    _    nega‐
       tive_sign"-""-""-""C"   _   int_frac_digits0222   _  frac_digits0222  _
       p_cs_precedes1111   _   p_sep_by_space0100   _   n_cs_precedes1111    _
       n_sep_by_space0100  _ p_sign_posn1111 _ n_sign_posn1422 _ int_p_cs_pre‐
       cedes1111   _   int_n_cs_precedes1111   _   int_p_sep_by_space0000    _
       int_n_sep_by_space0000 _ int_p_sign_posn1111 _ int_n_sign_posn1442


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 _ CSIEnabled _ Interface StabilityCommitted _ MT-LevelSee
       below.  _ StandardSee standards(7).



       The localeconv() function can be used safely in multithreaded  applica‐
       tions  without restriction on Oracle Solaris 11.4.0 and later. Portable
       applications, however, must be aware of that  in  other  platforms  and
       older  versions  of  Solaris, the returned pointer, and pointers within
       the structure, might be invalidated or the structure or the storage ar‐
       eas might be overwritten by a subsequent call to localeconv()  and,  in
       addition,  the  returned  pointer,  and  pointers within the structure,
       might be invalidated or the structure or the  storage  areas  might  be
       overwritten by subsequent calls to setlocale().

SEE ALSO
       setlocale(3C), attributes(7), environ(7), standards(7)


       Managing  System  Locales in Internationalizing and Localizing Applica‐
       tions in Oracle Solaris

HISTORY
       The localeconv() function has been included in all Sun and  Oracle  re‐
       leases of Solaris.

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