Name

localeconv

Synopsis

Obtains the conventions of the current locale

#include <locale.h>
struct lconv *localeconv( void );

The localeconv() function returns a pointer to a structure containing complete information on the locale-specific conventions for formatting numeric and monetary information. The values returned reflect the conventions of the current locale, which you can query or set using the setlocale() function.

The structure that localeconv() fills in has the type struct lconv, which is defined in the header file locale.h. The members of this structure describe how to format monetary as well as non-monetary numeric values in the locale. In C99, moreover, two sets of information describing monetary formatting are present: one describing local usage and one describing international usage, which calls for standard alphabetic currency symbols, and may also use a different number of decimal places.

The full set of members and their order in the structure may vary from one implementation to another, but they must include at least the members described here:

char *decimal_point;

The decimal point character, except when referring to money. In the default locale C, this pointer refers to the value ".".

char *thousands_sep;

The digit-grouping character: for example, the comma in "65,536". In spite of the name, not all locales group digits by thousands; see the next member, grouping.

char *grouping;

This pointer refers not to a text string, but to an array of numeric char values with the following ...

Get C in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.