LOCALECONV(3)              POSIX Programmer's Manual             LOCALECONV(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       localeconv -- return locale-specific information

SSYYNNOOPPSSIISS
       #include <locale.h>

       struct lconv *localeconv(void);

DDEESSCCRRIIPPTTIIOONN
       The functionality described on this reference page is aligned with the
       ISO C standard. Any conflict between the requirements described here
       and the ISO C standard is unintentional. This volume of POSIX.1-2017
       defers to the ISO C standard.

       The _l_o_c_a_l_e_c_o_n_v() function shall set the components of an object with
       the type ssttrruucctt llccoonnvv with the values appropriate for the formatting of
       numeric quantities (monetary and otherwise) according to the rules of
       the current locale.

       The members of the structure with type cchhaarr ** are pointers to strings,
       any of which (except ddeecciimmaall__ppooiinntt) can point to """", to indicate that
       the value is not available in the current locale or is of zero length.
       The members with type cchhaarr are non-negative numbers, any of which can
       be {CHAR_MAX} to indicate that the value is not available in the
       current locale.

       The members include the following:

       cchhaarr **ddeecciimmaall__ppooiinntt
             The radix character used to format non-monetary quantities.

       cchhaarr **tthhoouussaannddss__sseepp
             The character used to separate groups of digits before the
             decimal-point character in formatted non-monetary quantities.

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

       cchhaarr **iinntt__ccuurrrr__ssyymmbbooll
             The international currency symbol applicable to the current
             locale.  The first three characters contain the alphabetic
             international currency symbol in accordance with those specified
             in the ISO 4217:2001 standard. The fourth character (immediately
             preceding the null byte) is the character used to separate the
             international currency symbol from the monetary quantity.

       cchhaarr **ccuurrrreennccyy__ssyymmbbooll
             The local currency symbol applicable to the current locale.

       cchhaarr **mmoonn__ddeecciimmaall__ppooiinntt
             The radix character used to format monetary quantities.

       cchhaarr **mmoonn__tthhoouussaannddss__sseepp
             The separator for groups of digits before the decimal-point in
             formatted monetary quantities.

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

       cchhaarr **ppoossiittiivvee__ssiiggnn
             The string used to indicate a non-negative valued formatted
             monetary quantity.

       cchhaarr **nneeggaattiivvee__ssiiggnn
             The string used to indicate a negative valued formatted monetary
             quantity.

       cchhaarr iinntt__ffrraacc__ddiiggiittss
             The number of fractional digits (those after the decimal-point)
             to be displayed in an internationally formatted monetary
             quantity.

       cchhaarr ffrraacc__ddiiggiittss
             The number of fractional digits (those after the decimal-point)
             to be displayed in a formatted monetary quantity.

       cchhaarr pp__ccss__pprreecceeddeess
             Set to 1 if the ccuurrrreennccyy__ssyymmbbooll precedes the value for a non-
             negative formatted monetary quantity. Set to 0 if the symbol
             succeeds the value.

       cchhaarr pp__sseepp__bbyy__ssppaaccee
             Set to a value indicating the separation of the ccuurrrreennccyy__ssyymmbbooll,
             the sign string, and the value for a non-negative formatted
             monetary quantity.

       cchhaarr nn__ccss__pprreecceeddeess
             Set to 1 if the ccuurrrreennccyy__ssyymmbbooll precedes the value for a negative
             formatted monetary quantity. Set to 0 if the symbol succeeds the
             value.

       cchhaarr nn__sseepp__bbyy__ssppaaccee
             Set to a value indicating the separation of the ccuurrrreennccyy__ssyymmbbooll,
             the sign string, and the value for a negative formatted monetary
             quantity.

       cchhaarr pp__ssiiggnn__ppoossnn
             Set to a value indicating the positioning of the ppoossiittiivvee__ssiiggnn
             for a non-negative formatted monetary quantity.

       cchhaarr nn__ssiiggnn__ppoossnn
             Set to a value indicating the positioning of the nneeggaattiivvee__ssiiggnn
             for a negative formatted monetary quantity.

       cchhaarr iinntt__pp__ccss__pprreecceeddeess
             Set to 1 or 0 if the iinntt__ccuurrrr__ssyymmbbooll respectively precedes or
             succeeds the value for a non-negative internationally formatted
             monetary quantity.

       cchhaarr iinntt__nn__ccss__pprreecceeddeess
             Set to 1 or 0 if the iinntt__ccuurrrr__ssyymmbbooll respectively precedes or
             succeeds the value for a negative internationally formatted
             monetary quantity.

       cchhaarr iinntt__pp__sseepp__bbyy__ssppaaccee
             Set to a value indicating the separation of the iinntt__ccuurrrr__ssyymmbbooll,
             the sign string, and the value for a non-negative internationally
             formatted monetary quantity.

       cchhaarr iinntt__nn__sseepp__bbyy__ssppaaccee
             Set to a value indicating the separation of the iinntt__ccuurrrr__ssyymmbbooll,
             the sign string, and the value for a negative internationally
             formatted monetary quantity.

       cchhaarr iinntt__pp__ssiiggnn__ppoossnn
             Set to a value indicating the positioning of the ppoossiittiivvee__ssiiggnn
             for a non-negative internationally formatted monetary quantity.

       cchhaarr iinntt__nn__ssiiggnn__ppoossnn
             Set to a value indicating the positioning of the nneeggaattiivvee__ssiiggnn
             for a negative internationally formatted monetary quantity.

       The elements of ggrroouuppiinngg and mmoonn__ggrroouuppiinngg 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
                   remainder of the digits.

       _o_t_h_e_r       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 pp__sseepp__bbyy__ssppaaccee, nn__sseepp__bbyy__ssppaaccee, iinntt__pp__sseepp__bbyy__ssppaaccee, and
       iinntt__nn__sseepp__bbyy__ssppaaccee 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 sign string from
             the value.

       For iinntt__pp__sseepp__bbyy__ssppaaccee and iinntt__nn__sseepp__bbyy__ssppaaccee, the fourth character of
       iinntt__ccuurrrr__ssyymmbbooll is used instead of a space.

       The values of pp__ssiiggnn__ppoossnn, nn__ssiiggnn__ppoossnn, iinntt__pp__ssiiggnn__ppoossnn, and
       iinntt__nn__ssiiggnn__ppoossnn are interpreted according to the following:

       0     Parentheses surround the quantity and ccuurrrreennccyy__ssyymmbbooll or
             iinntt__ccuurrrr__ssyymmbbooll.

       1     The sign string precedes the quantity and ccuurrrreennccyy__ssyymmbbooll or
             iinntt__ccuurrrr__ssyymmbbooll.

       2     The sign string succeeds the quantity and ccuurrrreennccyy__ssyymmbbooll or
             iinntt__ccuurrrr__ssyymmbbooll.

       3     The sign string immediately precedes the ccuurrrreennccyy__ssyymmbbooll or
             iinntt__ccuurrrr__ssyymmbbooll.

       4     The sign string immediately succeeds the ccuurrrreennccyy__ssyymmbbooll or
             iinntt__ccuurrrr__ssyymmbbooll.

       The implementation shall behave as if no function in this volume of
       POSIX.1-2017 calls _l_o_c_a_l_e_c_o_n_v().

       The _l_o_c_a_l_e_c_o_n_v() function need not be thread-safe.

RREETTUURRNN VVAALLUUEE
       The _l_o_c_a_l_e_c_o_n_v() function shall return a pointer to the filled-in
       object. The application shall not modify the structure to which the
       return value points, nor any storage areas pointed to by pointers
       within the structure. The returned pointer, and pointers within the
       structure, might be invalidated or the structure or the storage areas
       might be overwritten by a subsequent call to _l_o_c_a_l_e_c_o_n_v().  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 _s_e_t_l_o_c_a_l_e() with the categories
       LC_ALL, LC_MONETARY, or LC_NUMERIC, or by calls to _u_s_e_l_o_c_a_l_e() which
       change the categories LC_MONETARY or LC_NUMERIC. The returned pointer,
       pointers within the structure, the structure, and the storage areas
       might also be invalidated if the calling thread is terminated.

EERRRROORRSS
       No errors are defined.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The following table illustrates the rules which may be used by four
       countries to format monetary quantities.

       +------------+-----------------+-----------------+----------------------+
       |  CCoouunnttrryy   | PPoossiittiivvee FFoorrmmaatt | NNeeggaattiivvee FFoorrmmaatt | IInntteerrnnaattiioonnaall FFoorrmmaatt |
       +------------+-----------------+-----------------+----------------------+
       |Italy       | EUR.1.230       | -EUR.1.230      | EUR.1.230            |
       |Netherlands | EUR 1.234,56    | EUR -1.234,56   | EUR 1.234,56         |
       |Norway      | kr1.234,56      | kr1.234,56-     | NOK 1.234,56         |
       |Switzerland | 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 _l_o_c_a_l_e_c_o_n_v() are:

         +-------------------+--------+-------------+--------+-------------+
         |                   | IIttaallyy  | NNeetthheerrllaannddss | NNoorrwwaayy | SSwwiittzzeerrllaanndd |
         +-------------------+--------+-------------+--------+-------------+
         |iinntt__ccuurrrr__ssyymmbbooll    | "EUR." |   "EUR "    | "NOK " |   "CHF "    |
         |ccuurrrreennccyy__ssyymmbbooll    | "EUR." |    "EUR"    |  "kr"  |   "SFrs."   |
         |mmoonn__ddeecciimmaall__ppooiinntt  |   ""   |     ","     |  ","   |     "."     |
         |mmoonn__tthhoouussaannddss__sseepp  |  "."   |     "."     |  "."   |     ","     |
         |mmoonn__ggrroouuppiinngg       |  "\3"  |    "\3"     |  "\3"  |    "\3"     |
         |ppoossiittiivvee__ssiiggnn      |   ""   |     ""      |   ""   |     ""      |
         |nneeggaattiivvee__ssiiggnn      |  "-"   |     "-"     |  "-"   |     "C"     |
         |iinntt__ffrraacc__ddiiggiittss    |   0    |      2      |   2    |      2      |
         |ffrraacc__ddiiggiittss        |   0    |      2      |   2    |      2      |
         |pp__ccss__pprreecceeddeess      |   1    |      1      |   1    |      1      |
         |pp__sseepp__bbyy__ssppaaccee     |   0    |      1      |   0    |      0      |
         |nn__ccss__pprreecceeddeess      |   1    |      1      |   1    |      1      |
         |nn__sseepp__bbyy__ssppaaccee     |   0    |      1      |   0    |      0      |
         |pp__ssiiggnn__ppoossnn        |   1    |      1      |   1    |      1      |
         |nn__ssiiggnn__ppoossnn        |   1    |      4      |   2    |      2      |
         |iinntt__pp__ccss__pprreecceeddeess  |   1    |      1      |   1    |      1      |
         |iinntt__nn__ccss__pprreecceeddeess  |   1    |      1      |   1    |      1      |
         |iinntt__pp__sseepp__bbyy__ssppaaccee |   0    |      0      |   0    |      0      |
         |iinntt__nn__sseepp__bbyy__ssppaaccee |   0    |      0      |   0    |      0      |
         |iinntt__pp__ssiiggnn__ppoossnn    |   1    |      1      |   1    |      1      |
         |iinntt__nn__ssiiggnn__ppoossnn    |   1    |      4      |   4    |      2      |
         +-------------------+--------+-------------+--------+-------------+
RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _f_p_r_i_n_t_f(), _f_s_c_a_n_f(), _i_s_a_l_p_h_a(), _i_s_a_s_c_i_i(), _n_l___l_a_n_g_i_n_f_o(), _s_e_t_l_o_c_a_l_e(),
       _s_t_r_c_a_t(), _s_t_r_c_h_r(), _s_t_r_c_m_p(), _s_t_r_c_o_l_l(), _s_t_r_c_p_y(), _s_t_r_f_t_i_m_e(),
       _s_t_r_l_e_n(), _s_t_r_p_b_r_k(), _s_t_r_s_p_n(), _s_t_r_t_o_k(), _s_t_r_x_f_r_m(), _s_t_r_t_o_d(),
       _u_s_e_l_o_c_a_l_e()

       The Base Definitions volume of POSIX.1-2017, <<llaannggiinnffoo..hh>>, <<llooccaallee..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                        LOCALECONV(3)
