MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Standard C Library Functions                       localeconv(3C)



NAME
     localeconv - get numeric formatting information

SYNOPSIS
     #include 

     struct lconv *localeconv(void);


DESCRIPTION
     The localeconv() function sets the components of  an  object
     with  type  struct  lconv  (defined  in ) 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 *decimalpoint;        /* "." */
       char *thousandssep;        /* "" (zero length string) */
       char *grouping;             /* "" */
       char *intcurrsymbol;      /* "" */
       char *currencysymbol;      /* "" */
       char *mondecimalpoint;    /* "" */
       char *monthousandssep;    /* "" */
       char *mongrouping;         /* "" */
       char *positivesign;        /* "" */
       char *negativesign;        /* "" */
       char intfracdigits;       /* CHARMAX */
       char fracdigits;           /* CHARMAX */
       char pcsprecedes;         /* CHARMAX */
       char psepbyspace;        /* CHARMAX */
       char ncsprecedes;         /* CHARMAX */
       char nsepbyspace;        /* CHARMAX */
       char psignposn;           /* CHARMAX*/
       char nsignposn;           /* CHARMAX */



     The following members are also available to SUSv3-conforming
     applications. See standards(5)

       char intpcsprecedes;     /* CHARMAX */
       char intpsepbyspace;    /* CHARMAX */
       char intncsprecedes;     /* CHARMAX */
       char intnsepbyspace;    /* CHARMAX */
       char intpsignposn;       /* CHARMAX */
       char intnsignposn;       /* CHARMAX */







SunOS 5.11          Last change: 12 Dec 2003                    1






Standard C Library Functions                       localeconv(3C)



     The members of the structure with type char *  are  strings,
     any  of  which  (except  decimalpoint)  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
     CHARMAX (defined in the  header) to indicate that
     the value is  not  available  in  the  current  locale.  The
     members are the following:

     char *decimalpoint        The decimal-point character  used
                                to  format  non-monetary  quanti-
                                ties.


     char *thousandssep        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 quanti-
                                ties.


     char *intcurrsymbol      The international currency symbol
                                applicable to the current locale.
                                The first three  characters  con-
                                tain 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  separate  the  interna-
                                tional currency symbol  from  the
                                monetary quantity.


     char *currencysymbol      The local currency symbol  appli-
                                cable to the current locale.


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


     char *monthousandssep    The  separator  for   groups   of
                                digits to the left of the decimal



SunOS 5.11          Last change: 12 Dec 2003                    2






Standard C Library Functions                       localeconv(3C)



                                point in formatted monetary quan-
                                tities.


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


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


     char *negativesign        The string  used  to  indicate  a
                                negative-valued  formatted  mone-
                                tary quantity.


     char intfracdigits       The number of  fractional  digits
                                (those   to   the  right  of  the
                                decimal point) to be displayed in
                                an    internationally   formatted
                                monetary quantity.


     char fracdigits           The number of  fractional  digits
                                (those   to   the  right  of  the
                                decimal point) to be displayed in
                                a formatted monetary quantity.


     char pcsprecedes         Set   to   1   or   0   if    the
                                currencysymbol respectively pre-
                                cedes or succeeds the value for a
                                non-negative  formatted  monetary
                                quantity.


     char psepbyspace        Set to 0 if  no  space  separates
                                the       currencysymbol      or
                                intcurrsymbol  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.






SunOS 5.11          Last change: 12 Dec 2003                    3






Standard C Library Functions                       localeconv(3C)



     char ncsprecedes         Set   to   1   or   0   if    the
                                currencysymbol respectively pre-
                                cedes or succeeds the value for a
                                negative formatted monetary quan-
                                tity.


     char nsepbyspace        Set to 0 if  no  space  separates
                                the       currencysymbol      or
                                intcurrsymbol  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 psignposn           Set to  a  value  indicating  the
                                positioning  of the positivesign
                                for  a   non-negative   formatted
                                monetary quantity.


     char nsignposn           Set to  a  value  indicating  the
                                positioning  of the negativesign
                                for a negative formatted monetary
                                quantity.


     char intpcsprecedes     Set   to   1   or   0   if    the
                                intcurrsymbol respectively pre-
                                cedes or succeeds the value for a
                                non-negative internationally for-
                                matted monetary quantity.


     char intncsprecedes     Set   to   1   or   0   if    the
                                intcurrsymbol respectively pre-
                                cedes or succeeds the value for a
                                negative  internationally format-
                                ted monetary quantity.


     char intpsepbyspace    Set to  a  value  indicating  the
                                separation         of         the
                                intcurrsymbol, the sign string,
                                and  the value for a non-negative
                                internationally  formatted  mone-
                                tary quantity.





SunOS 5.11          Last change: 12 Dec 2003                    4






Standard C Library Functions                       localeconv(3C)



     char intnsepbyspace    Set to  a  value  indicating  the
                                separation         of         the
                                intcurrsymbol, the sign string,
                                and  the  value  for  a  negative
                                internationally  formatted  mone-
                                tary quantity.


     char intpsignposn       Set to  a  value  indicating  the
                                positioning  of the positivesign
                                for a  non-negative  internation-
                                ally formatted monetary quantity.


     char intnsignposn       Set to  a  value  indicating  the
                                positioning  of the negativesign
                                for  a  negative  internationally
                                formatted monetary quantity.



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

     {CHARMAX}    No further grouping is to be performed.


     0             The previous element is to be repeatedly  used
                   for the remainder of the digits.


     other         The integer value is the number of digits that
                   comprise  the  current group. The next element
                   is examined to determine the size of the  next
                   group of digits before the current group.



     The    values     of     psepbyspace,     nsepbyspace,
     intpsepbyspace,  and  intnsepbyspace 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 separates them from the value; otherwise, a space
          separates the currency symbol from the value.


     2    If the currency symbol and sign string are adjacent,  a
          space  separates them; otherwise, a space separates the



SunOS 5.11          Last change: 12 Dec 2003                    5






Standard C Library Functions                       localeconv(3C)



          sign string from the value.



     In an SUSv3-conforming application,  for  intpsepbyspace
     and    intnsepbyspace,    the    fourth   character   of
     intcurrsymbol is used instead of a space.


     The values of psignposn, nsignposn, intpsignposn, and
     intnsignposn are interpreted according to the following:

     0    Parentheses surround the quantity  and  currencysymbol
          or intcurrsymbol.


     1    The   sign   string   precedes   the    quantity    and
          currencysymbol or intcurrsymbol.


     2    The   sign   string   succeeds   the    quantity    and
          currencysymbol or intcurrsymbol.


     3    The    sign    string    immediately    precedes    the
          currencysymbol or intcurrsymbol.


     4    The    sign    string    immediately    succeeds    the
          currencysymbol or intcurrsymbol.


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 coun-
     tries to format monetary quantities.




     Country            Positive         Negative         International
     
     Italy (IT)         L.1.234          -L.1.234         ITL.1.234
     



SunOS 5.11          Last change: 12 Dec 2003                    6






Standard C Library Functions                       localeconv(3C)



     Netherlands (NE)   F 1.234,56       F -1.234,56      NLG 1.234,56
     
     Norway (NO)        kr1.234,56       kr1.234,56-      NOK 1.234,56
     
     Switzerland (SW)   SFrs.1,234.56    SFrs.1,234.56C   CHF 1,234.56
                                                     
                                                     
                                                     
     For these four countries,  the  respective  values for  the
     monetary  members  of the structure returned by localeconv()
     are as follows:                                 
                                                     
                                                     
                                                     
                                                     
                                                            IT       NE       NO       SW
     intcurrsymbol                                        "ITL."   "NLG "   "NOK "   "CHF "
     currencysymbol                                        "L."     "F"      "kr"     "SFrs."
     mondecimalpoint                                       ""       ","      ","      "."
     monthousandssep                                       "."      "."      "."      ","
     mongrouping                                           "\3"     "\3"     "\3"     "\3"
     positivesign                                          ""       ""       ""       ""
     negativesign                                          "-"      "-"      "-"      "C"
     intfracdigits                                        0        2        2        2
     fracdigits                                            0        2        2        2
     pcsprecedes                                          1        1        1        1
     psepbyspace                                         0        1        0        0
     ncsprecedes                                          1        1        1        1
     nsepbyspace                                         0        1        0        0
     psignposn                                            1        1        1        1
     nsignposn                                            1        4        2        2
     intpcsprecedes                                       1        1        1        1
     intncsprecedes                                       1        1        1        1
     intpsepbyspace                                      0        0        0        0
     intnsepbyspace                                      0        0        0        0
     intpsignposn                                        1        1        1        1
     intnsignposn                                        1        4        4        2
                                                     
                                                     
ATRIBUTES                                           
     See attributes(5) for descriptions of the  following  attri-
     butes:                                          
                                                     
                                                     
                                                     
                                                     
                                                     
                                                     







SunOS 5.11          Last change: 12 Dec 2003                    7






Standard C Library Functions                       localeconv(3C)



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     CSI                          Enabled                     
    
     Interface Stability          Standard                    
    
     MT-Level                     MT-Safe with exceptions     
    



     The  localeconv()  function  can  be  used  safely  in  mul-
     tithreaded  applications,  as  long  as setlocale(3C) is not
     being called to change the locale.

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





































SunOS 5.11          Last change: 12 Dec 2003                    8



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™