lconv
<locale.h>
The struct lconv
contains numeric and monetary formatting rules as defined by a C locale. Objects of this struct may be obtained with localeconv . The members of lconv
are values of type char and of type char*. Each char* member except decimal_point
may be pointing at a null character (that is, at an empty C-string). The members of type char are all non-negative numbers, any of which may be CHAR_MAX if the corresponding value is not available in the current C locale.
Contents
[edit] Member objects
[edit] Non-monetary numeric formatting parameters
(public member object)
(public member object)
(public member object)
[edit] Monetary numeric formatting parameters
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
[edit] Local monetary numeric formatting parameters
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
[edit] International monetary numeric formatting parameters
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
(public member object)
The characters of the C-strings pointed to by grouping and mon_grouping are interpreted according to their numeric values. When the terminating '0円' is encountered, the last value seen is assumed to repeat for the remainder of digits. If CHAR_MAX is encountered, no further digits are grouped. The typical grouping of three digits at a time is "003円".
The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space, int_n_sep_by_space are interpreted as follows:
The values of p_sign_posn, n_sign_posn, int_p_sign_posn, int_n_sign_posn are interpreted as follows:
[edit] Example
#include <locale.h> #include <stdio.h> int main(void) { setlocale (LC_ALL, "ja_JP.UTF-8"); struct lconv* lc = localeconv (); printf ("Japanese currency symbol: %s(%s)\n", lc->currency_symbol, lc->int_curr_symbol); }
Possible output:
Japanese currency symbol: \(JPY )
[edit] References
- C23 standard (ISO/IEC 9899:2024):
- 7.11/2 Localization <locale.h> (p: TBD)
- C17 standard (ISO/IEC 9899:2018):
- 7.11/2 Localization <locale.h> (p: TBD)
- C11 standard (ISO/IEC 9899:2011):
- 7.11/2 Localization <locale.h> (p: 223)
- C99 standard (ISO/IEC 9899:1999):
- 7.11/2 Localization <locale.h> (p: 204)
- C89/C90 standard (ISO/IEC 9899:1990):
- 4.4 LOCALIZATION <locale.h>