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
charvalues with the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access