Format
#include <langinfo.h> char *nl_langinfo(nl_item item);
Language Level: XPG4
nl_langinfo retrieves from the current locale the
string that describes the requested information specified by item.
The constant names and values for item are defined in <langinfo.h>. For a list of macros that define the constants used to identify the information queried in the current locale, see the table of defined macros under <langinfo.h>.
You cannot retrieve the following information for the current locale:
t_fmt_ampm
era
era_year
era_d_fmt
alt_digits
t_fmt_ampm
alt_digits
Return Value
nl_langinfo returns a pointer to a
null-terminated string containing information about the active
language or cultural area. The active language or cultural area
is determined by the most recent setlocale call. Subsequent calls
to the setlocale function may modify the string that the return
value points to. Your own code cannot modify the array.
If item is not valid, nl_langinfo returns a pointer to an empty string.
Example
This example uses nl_langinfo to retrieve
the current codeset name.
#include <langinfo.h> #include <stdio.h>
int main(void)
{
printf("Current codeset is %s\n", nl_langinfo(CODESET));
return 0;
/******************************************************
The output should be similar to :
Current codeset is IBM-850 ******************************************************/ }
![]()
![]()
localdtconv -- Return Date and
Time Formatting Convention
localeconv
-- Retrieve Numeric Formatting Convention
setlocale -- Set
Locale
<langinfo.h>