The GNU C Library - Numeric Formatting

Node: Numeric Formatting Prev: Standard Locales Up: Locales

Numeric Formatting

When you want to format a number or a currency amount using the conventions of the current locale, you can use the function localeconv to get the data on how to do it. The function localeconv is declared in the header file `locale.h'.

Function struct lconv * localeconv (void)
The localeconv function returns a pointer to a structure whose components contain information about how numeric and monetary values should be formatted in the current locale.

You shouldn't modify the structure or its contents. The structure might be overwritten by subsequent calls to localeconv , or by calls to setlocale , but no other function in the library overwrites this value.

Data Type struct lconv
This is the data type of the value returned by localeconv .

If a member of the structure struct lconv has type char , and the value is CHAR_MAX , it means that the current locale has no value for that parameter.

General Numeric Parameters for formatting numbers and
currency amounts.
Currency Symbol How to print the symbol that identifies an
amount of money (e.g. `$').
Sign of Money Amount How to print the (positive or negative) sign
for a monetary amount, if one exists.


Up: Locales