1LOCALECONV(3P)             POSIX Programmer's Manual            LOCALECONV(3P)
2
3
4

PROLOG

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

NAME

12       localeconv — return locale-specific information
13

SYNOPSIS

15       #include <locale.h>
16
17       struct lconv *localeconv(void);
18

DESCRIPTION

20       The functionality described on this reference page is aligned with  the
21       ISO C  standard.  Any  conflict between the requirements described here
22       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
23       defers to the ISO C standard.
24
25       The  localeconv()  function  shall set the components of an object with
26       the type struct lconv with the values appropriate for the formatting of
27       numeric  quantities  (monetary and otherwise) according to the rules of
28       the current locale.
29
30       The members of the structure with type char * are pointers to  strings,
31       any  of  which (except decimal_point) can point to "", to indicate that
32       the value is not available in the current locale or is of zero  length.
33       The  members  with type char are non-negative numbers, any of which can
34       be {CHAR_MAX} to indicate that the value is not available in  the  cur‐
35       rent locale.
36
37       The members include the following:
38
39       char *decimal_point
40             The radix character used to format non-monetary quantities.
41
42       char *thousands_sep
43             The  character used to separate groups of digits before the deci‐
44             mal-point character in formatted non-monetary quantities.
45
46       char *grouping
47             A string whose elements taken as one-byte integer values indicate
48             the  size of each group of digits in formatted non-monetary quan‐
49             tities.
50
51       char *int_curr_symbol
52             The international  currency  symbol  applicable  to  the  current
53             locale.  The first three characters contain the alphabetic inter‐
54             national currency symbol in accordance with  those  specified  in
55             the  ISO 4217:2001  standard.  The  fourth character (immediately
56             preceding the null byte) is the character used  to  separate  the
57             international currency symbol from the monetary quantity.
58
59       char *currency_symbol
60             The local currency symbol applicable to the current locale.
61
62       char *mon_decimal_point
63             The radix character used to format monetary quantities.
64
65       char *mon_thousands_sep
66             The  separator  for  groups of digits before the decimal-point in
67             formatted monetary quantities.
68
69       char *mon_grouping
70             A string whose elements taken as one-byte integer values indicate
71             the  size  of  each group of digits in formatted monetary quanti‐
72             ties.
73
74       char *positive_sign
75             The string used to indicate a non-negative valued formatted mone‐
76             tary quantity.
77
78       char *negative_sign
79             The  string used to indicate a negative valued formatted monetary
80             quantity.
81
82       char int_frac_digits
83             The number of fractional digits (those after  the  decimal-point)
84             to  be  displayed  in an internationally formatted monetary quan‐
85             tity.
86
87       char frac_digits
88             The number of fractional digits (those after  the  decimal-point)
89             to be displayed in a formatted monetary quantity.
90
91       char p_cs_precedes
92             Set to 1 if the currency_symbol precedes the value for a non-neg‐
93             ative formatted monetary quantity. Set to 0 if  the  symbol  suc‐
94             ceeds the value.
95
96       char p_sep_by_space
97             Set  to a value indicating the separation of the currency_symbol,
98             the sign string, and the value for a non-negative formatted mone‐
99             tary quantity.
100
101       char n_cs_precedes
102             Set to 1 if the currency_symbol precedes the value for a negative
103             formatted monetary quantity. Set to 0 if the symbol succeeds  the
104             value.
105
106       char n_sep_by_space
107             Set  to a value indicating the separation of the currency_symbol,
108             the sign string, and the value for a negative formatted  monetary
109             quantity.
110
111       char p_sign_posn
112             Set  to  a  value indicating the positioning of the positive_sign
113             for a non-negative formatted monetary quantity.
114
115       char n_sign_posn
116             Set to a value indicating the positioning  of  the  negative_sign
117             for a negative formatted monetary quantity.
118
119       char int_p_cs_precedes
120             Set  to  1  or  0 if the int_curr_symbol respectively precedes or
121             succeeds the value for a non-negative  internationally  formatted
122             monetary quantity.
123
124       char int_n_cs_precedes
125             Set  to  1  or  0 if the int_curr_symbol respectively precedes or
126             succeeds the value for a negative internationally formatted mone‐
127             tary quantity.
128
129       char int_p_sep_by_space
130             Set  to a value indicating the separation of the int_curr_symbol,
131             the sign string, and the value for a non-negative internationally
132             formatted monetary quantity.
133
134       char int_n_sep_by_space
135             Set  to a value indicating the separation of the int_curr_symbol,
136             the sign string, and the value  for  a  negative  internationally
137             formatted monetary quantity.
138
139       char int_p_sign_posn
140             Set  to  a  value indicating the positioning of the positive_sign
141             for a non-negative internationally formatted monetary quantity.
142
143       char int_n_sign_posn
144             Set to a value indicating the positioning  of  the  negative_sign
145             for a negative internationally formatted monetary quantity.
146
147       The  elements of grouping and mon_grouping are interpreted according to
148       the following:
149
150       {CHAR_MAX}  No further grouping is to be performed.
151
152       0           The previous element is  to  be  repeatedly  used  for  the
153                   remainder of the digits.
154
155       other       The integer value is the number of digits that comprise the
156                   current group. The next element is  examined  to  determine
157                   the  size  of  the  next group of digits before the current
158                   group.
159
160       The values of p_sep_by_space, n_sep_by_space,  int_p_sep_by_space,  and
161       int_n_sep_by_space are interpreted according to the following:
162
163       0     No space separates the currency symbol and value.
164
165       1     If the currency symbol and sign string are adjacent, a space sep‐
166             arates them from the value; otherwise, a space separates the cur‐
167             rency symbol from the value.
168
169       2     If the currency symbol and sign string are adjacent, a space sep‐
170             arates them; otherwise, a space separates the  sign  string  from
171             the value.
172
173       For  int_p_sep_by_space and int_n_sep_by_space, the fourth character of
174       int_curr_symbol is used instead of a space.
175
176       The  values   of   p_sign_posn,   n_sign_posn,   int_p_sign_posn,   and
177       int_n_sign_posn are interpreted according to the following:
178
179       0     Parentheses   surround   the   quantity  and  currency_symbol  or
180             int_curr_symbol.
181
182       1     The sign string precedes  the  quantity  and  currency_symbol  or
183             int_curr_symbol.
184
185       2     The  sign  string  succeeds  the  quantity and currency_symbol or
186             int_curr_symbol.
187
188       3     The sign  string  immediately  precedes  the  currency_symbol  or
189             int_curr_symbol.
190
191       4     The  sign  string  immediately  succeeds  the  currency_symbol or
192             int_curr_symbol.
193
194       The implementation shall behave as if no function  in  this  volume  of
195       POSIX.1‐2017 calls localeconv().
196
197       The localeconv() function need not be thread-safe.
198

RETURN VALUE

200       The  localeconv()  function  shall  return  a  pointer to the filled-in
201       object. The application shall not modify the  structure  to  which  the
202       return  value  points,  nor  any  storage  areas pointed to by pointers
203       within the structure. The returned pointer,  and  pointers  within  the
204       structure,  might  be invalidated or the structure or the storage areas
205       might be overwritten by a subsequent call to  localeconv().   In  addi‐
206       tion, the returned pointer, and pointers within the structure, might be
207       invalidated or the structure or the storage areas might be  overwritten
208       by subsequent calls to setlocale() with the categories LC_ALL, LC_MONE‐
209       TARY, or LC_NUMERIC, or by calls to uselocale() which change the  cate‐
210       gories LC_MONETARY or LC_NUMERIC. The returned pointer, pointers within
211       the structure, the structure, and  the  storage  areas  might  also  be
212       invalidated if the calling thread is terminated.
213

ERRORS

215       No errors are defined.
216
217       The following sections are informative.
218

EXAMPLES

220       None.
221

APPLICATION USAGE

223       The  following  table  illustrates  the rules which may be used by four
224       countries to format monetary quantities.
225
226       ┌────────────┬─────────────────┬─────────────────┬──────────────────────┐
227Country   Positive Format Negative Format International Format 
228       ├────────────┼─────────────────┼─────────────────┼──────────────────────┤
229       │Italy       │ €.1.230         │ -€.1.230        │ EUR.1.230            │
230       │Netherlands │ € 1.234,56      │ € -1.234,56     │ EUR 1.234,56         │
231       │Norway      │ kr1.234,56      │ kr1.234,56-     │ NOK 1.234,56         │
232       │Switzerland │ SFrs.1,234.56   │ SFrs.1,234.56C  │ CHF 1,234.56         │
233       └────────────┴─────────────────┴─────────────────┴──────────────────────┘
234       For these four countries, the respective values for the  monetary  mem‐
235       bers of the structure returned by localeconv() are:
236
237         ┌───────────────────┬────────┬─────────────┬────────┬─────────────┐
238         │                   │ Italy  Netherlands Norway Switzerland 
239         ├───────────────────┼────────┼─────────────┼────────┼─────────────┤
240int_curr_symbol    │ "EUR." │   "EUR "    │ "NOK " │   "CHF "    │
241currency_symbol    │  "€."  │     "€"     │  "kr"  │   "SFrs."   │
242mon_decimal_point  │   ""   │     ","     │  ","   │     "."     │
243mon_thousands_sep  │  "."   │     "."     │  "."   │     ","     │
244mon_grouping       │  "\3"  │    "\3"     │  "\3"  │    "\3"     │
245positive_sign      │   ""   │     ""      │   ""   │     ""      │
246negative_sign      │  "-"   │     "-"     │  "-"   │     "C"     │
247int_frac_digits    │   0    │      2      │   2    │      2      │
248frac_digits        │   0    │      2      │   2    │      2      │
249p_cs_precedes      │   1    │      1      │   1    │      1      │
250p_sep_by_space     │   0    │      1      │   0    │      0      │
251n_cs_precedes      │   1    │      1      │   1    │      1      │
252n_sep_by_space     │   0    │      1      │   0    │      0      │
253p_sign_posn        │   1    │      1      │   1    │      1      │
254n_sign_posn        │   1    │      4      │   2    │      2      │
255int_p_cs_precedes  │   1    │      1      │   1    │      1      │
256int_n_cs_precedes  │   1    │      1      │   1    │      1      │
257int_p_sep_by_space │   0    │      0      │   0    │      0      │
258int_n_sep_by_space │   0    │      0      │   0    │      0      │
259int_p_sign_posn    │   1    │      1      │   1    │      1      │
260int_n_sign_posn    │   1    │      4      │   4    │      2      │
261         └───────────────────┴────────┴─────────────┴────────┴─────────────┘

RATIONALE

263       None.
264

FUTURE DIRECTIONS

266       None.
267

SEE ALSO

269       fprintf(),  fscanf(), isalpha(), isascii(), nl_langinfo(), setlocale(),
270       strcat(),  strchr(),   strcmp(),   strcoll(),   strcpy(),   strftime(),
271       strlen(),  strpbrk(),  strspn(),  strtok(), strxfrm(), strtod(), uselo‐
272       cale()
273
274       The Base Definitions volume of POSIX.1‐2017, <langinfo.h>, <locale.h>
275
277       Portions of this text are reprinted and reproduced in  electronic  form
278       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
279       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
280       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
281       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
282       event of any discrepancy between this version and the original IEEE and
283       The Open Group Standard, the original IEEE and The Open Group  Standard
284       is  the  referee document. The original Standard can be obtained online
285       at http://www.opengroup.org/unix/online.html .
286
287       Any typographical or formatting errors that appear  in  this  page  are
288       most likely to have been introduced during the conversion of the source
289       files to man page format. To report such errors,  see  https://www.ker
290       nel.org/doc/man-pages/reporting_bugs.html .
291
292
293
294IEEE/The Open Group                  2017                       LOCALECONV(3P)
Impressum