Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

localeconv - Query/change locale-specific data

&pagelevel(4)&pagelevel

Definition   

#include <locale.h>

struct lconv *localeconv(void);

localeconv sets the components of a structure of type struct lconv to values which match the current locale. The supplied values can be used in formatted output to represent monetary and non-monetary numerical values on a locale-specific basis.

At the start of the program the default locale is "C" (LC_C_C). The locale can be changed by calling the setlocale function with the categories LC_MONETARY, LC_NUMERIC or LC_ALL. When localeconv is called again, it matches the values in the structure components to the new locale.


Return val.

Pointer to the structure in which the values have been entered.

  1. Components for non-monetary numerical values (LC_NUMERIC):

    char *decimal_point

    Decimal point.

    char *thousands_sep

    Separator for grouping the digits in front of the decimal point.

    char *grouping

    String whose elements specify the length of each group of digits

  2. Components for monetary values (LC_MONETARY):

    char *int_curr_symbol

    The international currency symbol appropriate to the locale. The first three characters contain the alphabetic international currency symbol, in accordance with the convention defined in ISO 4217:1897. The fourth character is the separator between the international currency symbol and the amount.
    In the locale “De.EDF04F@euro”, the value “EUR” is entered as an alphabetical currency symbol.

    char *currency_symbol

    The currency symbol corresponding to the locale.

    char *mon_decimal_point

    Decimal point..

    char *mon_thousands_sep

    Separator for grouping the digits in front of the decimal point.

    char *mon_grouping

    String whose elements specify the length of each group of digits.

    char *positive_sign

    String indicating a non-negative amount.

    char *negative_sign

    String indicating a negative amount.

    char int_frac_digits

    Number of decimal places for an internationally structured amount.

    char frac_digits

    Number of decimal places for a locally structured amount.

    char p_cs_precedes

    1          if the currency symbol precedes the non-negative amount.

    0          if the currency symbol follows the non-negative amount.

    char n_cs_precedes

    1          if the currency symbol precedes the negative amount.

    0          if the currency symbol follows the negative amount.

    char p_sep_by_space

    1          if the currency symbol is separated from a non-negative amount by a space.

    0          if not.

    char n_sep_by_space

    1          if the currency symbol is separated from a negative amount by a space.

    0          if not.

    char p_sign_posn

    Position of the positive_sign for a non-negative amount.

    char n_sign_posn

    Position of the negative_sign for a negative amount.

The char elements of grouping and mon_grouping define the number of digits for the groups to the left of the decimal point, beginning with the first group to the left of the decimal point (e.g. thousands). The entries are interpreted as follows:

CHAR_MAX

Corresponds to the highest EBCDIC value (255) and causes no further grouping to be carried out.

0

The null byte causes the entry of the preceding char element to apply to the grouping of all remaining digits.

Others

The integer value applies to the number of digits in the current group. The next char element defines the number of digits in the next group.

Die Werte von p_sign_posn und n_sign_posn werden wie folgt interpretiert:

0

Amount and currency_symbol are enclosed in parentheses.

1

The sign precedes the amount and currency_symbol.

2

The sign comes after the amount and currency_symbol.

3

The sign immediately precedes currency_symbol.

4

The sign comes immediately after currency_symbol.

Notes

The available locales are described in chapter “Locale”.

The components of the supplied structure must not be explicitly overwritten by the user. New values for the structure can be supplied only by calling localeconv.

In the current locale, no values can be defined for various structure components. This is indicated for components of type char * by a pointer to "", and for components of type char by the value CHAR_MAX (value 255).

See also

setlocale