• <locale.h>
In computing, locale.h is an C programming language header file, used for purposes of localization. The header provides two key functions: localeconv and setlocale. The former provides access to the current locale, while the latter allows one to set the current locale. The header also defines the struct lconv, which stores information about a given locale, including the local preference for the display of numbers and currency.
Usage
Inclusion
C
#include <locale.h>
C++
#include <clocale>
Functions
struct lconv* localeconv(void);
char* setlocale(int, const char*);
Example
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main(void)
{
/* Locale is set to "C" before this. This call sets it
to the "current locale" by reading environment variables: */
setlocale(LC_ALL, "");
const struct lconv * const currentlocale = localeconv();
printf("In the current locale, the default currency symbol is: %s\n",
currentlocale->currency_symbol);
return EXIT_SUCCESS;
}
In computing, locale.h is an C programming language header file, used for purposes of localization. The header provides two key functions: localeconv and setlocale. The former provides access to the current locale, while the latter allows one to set the current locale. The header also defines the struct lconv, which stores information about a given locale, including the local preference for the display of numbers and currency.
Usage
Inclusion
C
#include <locale.h>
C++
#include <clocale>
Functions
struct lconv* localeconv(void);
char* setlocale(int, const char*);
Example
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main(void)
{
/* Locale is set to "C" before this. This call sets it
to the "current locale" by reading environment variables: */
setlocale(LC_ALL, "");
const struct lconv * const currentlocale = localeconv();
printf("In the current locale, the default currency symbol is: %s\n",
currentlocale->currency_symbol);
return EXIT_SUCCESS;
}
0 comments:
Post a Comment