localeconv Function

Sets the components of an structure with locale-specific values appropriate for the formatting of numeric quantities.

Attention: This function is not implemented when building with MPLAB XC8 for PIC MCUs. It is implemented for all other devices and compilers; however, only the default "C" locale is supported.

Include

<locale.h>

Prototype

struct lconv * localeconv(void);

Return Value

The function returns a pointer to the completed object, which shall not be modified by the program, but may be overwritten by a subsequent call to this function. In addition, calls to the setlocale() function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may overwrite the contents of the structure.

Remarks

The function sets the components of a structure with locale-specific values appropriate for the formatting of numeric quantities. Structure members of type char * (with the exception of decimal_point) can point to "", to indicate that the value is not available in the current locale or is of zero length. Apart from grouping and mon_grouping, the strings shall start and end in the initial shift state. The members with type char are non-negative numbers, any of which can be CHAR_MAX to indicate that the value is not available in the current locale.

Those MPLAB XC compilers that implement setlocale() only support the "C", which specifies the minimal environment for C translation.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <locale.h>

struct lconv * ll;

int main(void) {
  ll = localeconv();
  setlocale(LC_ALL, "C");
}