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
19

DESCRIPTION

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

RETURN VALUE

225       The localeconv() function shall  return  a  pointer  to  the  filled-in
226       object.  The  application  shall not modify the structure pointed to by
227       the return value which may be  overwritten  by  a  subsequent  call  to
228       localeconv().  In  addition,  calls  to setlocale() with the categories
229       LC_ALL,  LC_MONETARY,  or LC_NUMERIC may overwrite the contents of  the
230       structure.
231

ERRORS

233       No errors are defined.
234
235       The following sections are informative.
236

EXAMPLES

238       None.
239

APPLICATION USAGE

241       The  following  table  illustrates  the rules which may be used by four
242       countries to format monetary quantities.
243
244          Country     Positive Format Negative Format International Format
245          Italy       L.1.230         -L.1.230        ITL.1.230
246          Netherlands F 1.234,56      F -1.234,56     NLG 1.234,56
247          Norway      kr1.234,56      kr1.234,56-     NOK 1.234,56
248          Switzerland SFrs.1,234.56   SFrs.1,234.56C  CHF 1,234.56
249
250       For these four countries, the respective values for the  monetary  mem‐
251       bers of the structure returned by localeconv() are:
252
253                                Italy   Netherlands  Norway  Switzerland
254            int_curr_symbol     "ITL."  "NLG "       "NOK "  "CHF "
255            currency_symbol     "L."    "F"          "kr"    "SFrs."
256            mon_decimal_point   ""      ","          ","     "."
257            mon_thousands_sep   "."     "."          "."     ","
258            mon_grouping        "\3"    "\3"         "\3"    "\3"
259            positive_sign       ""      ""           ""      ""
260            negative_sign       "-"     "-"          "-"     "C"
261            int_frac_digits     0       2            2       2
262            frac_digits         0       2            2       2
263            p_cs_precedes       1       1            1       1
264
265            p_sep_by_space      0       1            0       0
266            n_cs_precedes       1       1            1       1
267            n_sep_by_space      0       1            0       0
268            p_sign_posn         1       1            1       1
269            n_sign_posn         1       4            2       2
270            int_p_cs_precedes   1       1            1       1
271            int_n_cs_precedes   1       1            1       1
272            int_p_sep_by_space  0       0            0       0
273            int_n_sep_by_space  0       0            0       0
274            int_p_sign_posn     1       1            1       1
275            int_n_sign_posn     1       4            4       2
276

RATIONALE

278       None.
279

FUTURE DIRECTIONS

281       None.
282

SEE ALSO

284       isalpha(),  isascii(),  nl_langinfo(),  printf(), scanf(), setlocale(),
285       strcat(),  strchr(),   strcmp(),   strcoll(),   strcpy(),   strftime(),
286       strlen(),  strpbrk(), strspn(), strtok(), strxfrm(), strtod(), the Base
287       Definitions volume of IEEE Std 1003.1-2001, <langinfo.h>, <locale.h>
288
290       Portions of this text are reprinted and reproduced in  electronic  form
291       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
292       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
293       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
294       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
295       event of any discrepancy between this version and the original IEEE and
296       The Open Group Standard, the original IEEE and The Open Group  Standard
297       is  the  referee document. The original Standard can be obtained online
298       at http://www.opengroup.org/unix/online.html .
299
300
301
302IEEE/The Open Group                  2003                       LOCALECONV(3P)
Impressum