lconv(4)
NAME
lconv − numeric and monetary formatting information
DESCRIPTION
The type struct lconv is declared in the header file <locale.h>. This structure contains members related to the formatting of numeric values. The structure contains the following members, and in the "C" locale they have the indicated values.
| char ∗decimal_point; | /∗ "." ∗/ |
| char ∗thousands_sep; | /∗ "" ∗/ |
| char ∗grouping; | /∗ "" ∗/ |
| char ∗int_curr_symbol; | /∗ "" ∗/ |
| char ∗currency_symbol; | /∗ "" ∗/ |
| char ∗mon_decimal_point; | /∗ "" ∗/ |
| char ∗mon_thousands_sep; | /∗ "" ∗/ |
| char ∗mon_grouping; | /∗ "" ∗/ |
| char ∗positive_sign; | /∗ "" ∗/ |
| char ∗negative_sign; | /∗ "" ∗/ |
| char int_frac_digits; | /∗ CHAR_MAX ∗/ |
| char frac_digits; | /∗ CHAR_MAX ∗/ |
| char p_cs_precedes; | /∗ CHAR_MAX ∗/ |
| char p_sep_by_space; | /∗ CHAR_MAX ∗/ |
| char n_cs_precedes; | /∗ CHAR_MAX ∗/ |
| char n_sep_by_space; | /∗ CHAR_MAX ∗/ |
| char p_sign_posn; | /∗ CHAR_MAX ∗/ |
| char n_sign_posn; | /∗ CHAR_MAX ∗/ |
The members of the structure with type char ∗ are pointers to strings, any of which (except decimal_point) can point to "" to indicate that the value is not available in the current locale or is of zero length. The members with type char are nonnegative numbers, any of which can be CHAR_MAX (see <limits.h>) to indicate that the value is not available in the current locale.
The members are further described here.
char ∗decimal_point
The decimal point character used to format non-monetary quantities.
char ∗thousands_sep
The character used to separate groups of digits before the decimal point character in formatted non-monetary quantities.
char ∗grouping A string whose elements indicate the size of each group of digits in formatted non-monetary quantities (see below).
char ∗int_curr_symbol
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 ISO 4217 Codes for the Representation of Currency and Funds. The fourth character (immediately preceding the terminating null character) is the character used to separate the international currency symbol from the monetary quantity.
char ∗currency_symbol
The local currency symbol applicable to the current locale.
char ∗mon_decimal_point
The decimal point character used to format monetary quantities.
char ∗mon_thousands_sep
The separator for groups of digits before the decimal point in formatted monetary quantities.
char ∗mon_grouping
A string whose elements indicate the size of each group of digits in formatted monetary quantities (see below).
char ∗positive_sign
The string used to indicate a nonnegative-valued formatted monetary quantity.
char ∗negative_sign
The string used to indicate a negative-valued formatted monetary quantity.
char int_frac_digits
The number of fractional digits (those after the decimal point) to be displayed in a internationally formatted monetary quantity.
char frac_digits
The number of fractional digits (those after the decimal point) to be displayed in a formatted monetary quantity.
char p_cs_precedes
Set to 1 or 0 if the currency_symbol respectively precedes of succeeds the value for a nonnegative formatted monetary quantity.
char p_sep_by_space
Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a nonnegative formatted monetary quantity.
char n_cs_precedes
Set to 1 or 0 if the currency_symbol respectively precedes of succeeds the value for a negative formatted monetary quantity.
char n_sep_by_space
Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a negative formatted monetary quantity.
char p_sign_posn
Set to a value indicating the positioning of the positive_sign for a nonnegative formatted monetary quantity.
char n_sign_posn
Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity.
The elements of grouping and mon_grouping 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.
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 p_sign_posn and n_sign_posn are interpreted according to the following:
0 Parentheses surround the quantity and currency_symbol.
1 The sign string precedess the quantity and currency_symbol.
2 The sign string succeeds the quantity and currency_symbol.
3 The sign string immediately precedes the currency_symbol.
4 The sign string immediately succeeds the currency_symbol.
The command montbl(1M) can be used to create the data file that must be placed in /usr/lib/locale/locale/LC_MONETARY to define the locale’s monetary information. The numeric data that must be in the file /usr/lib/locale/locale/LC_NUMERIC may be created by the command chrtbl(1M).
EXAMPLES
The following table illustrates the rules which may well be used by the indicated countries to format monetary quantities.
| Country | Positive format | Negative format | International format |
| Italy | L.1.234 | −L.1.234 | ITL.1.234 |
| Netherlands | F 1.234,56 | F −1.234,56 | NLG 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 countries, the respective values for the monetary members of the lconv structure are:
| Italy | Netherlands | Norway | Switzerland | |
| int_curr_symbol | "ITL." | "NLB " | "NOK " | "CHF " |
| currency_symbol | "L." | "F" | "kr" | "SFrs." |
| mon_decimal_point | "" | "," | "," | "." |
| mon_thousands_sep | "." | "." | "." | "," |
| mon_grouping | "3" | "3" | "3" | "3" |
| positive_sign | "" | "" | "" | "" |
| negative_sign | "−" | "−" | "−" | "C" |
| int_frac_digits | 0 | 2 | 2 | 2 |
| frac_digits | 0 | 2 | 2 | 2 |
| p_cs_precedes | 1 | 1 | 1 | 1 |
| p_sep_by_space | 0 | 1 | 0 | 0 |
| n_cs_precedes | 1 | 1 | 1 | 1 |
| n_sep_by_space | 0 | 1 | 0 | 0 |
| p_sign_posn | 1 | 1 | 1 | 1 |
| n_sign_posn | 1 | 4 | 2 | 2 |
NOTES
<locale.h> also declares the setlocale(3C) and localeconv(3C) functions and defines the macros used as the category values for the setlocale function.
FILES
/usr/lib/locale/locale/LC_NUMERIC
data file that contains the numeric formatting information for locale
/usr/lib/locale/locale/LC_MONETARY
data file that contains the monetary formatting information for locale
The files contain plain text describing the contents of each field, one field per line in the order indicated above. LC_NUMERIC specifies the first three fields of the structure, LC_MONETARY specifies the remaining fields. Character string values should be specified without quotes. Numeric values should be specified by the ASCII digits representing the numeric value. For the two “grouping” fields, the numbers should be separated by a space and the character “∗” may be used to represent CHAR_MAX.
SEE ALSO
atof(3C), gcvt(3C), localeconv(3C), setlocale(3C), strtod(3C).
chrtbl(1M), montbl(1M) in the CX/UX Administrator’s Reference Manual.
CX/UX Programmer’s Reference Manual