1NL_LANGINFO(P) POSIX Programmer's Manual NL_LANGINFO(P)
2
3
4
6 nl_langinfo - language information
7
9 #include <langinfo.h>
10
11 char *nl_langinfo(nl_item item);
12
13
15 The nl_langinfo() function shall return a pointer to a string contain‐
16 ing information relevant to the particular language or cultural area
17 defined in the program's locale (see <langinfo.h>). The manifest con‐
18 stant names and values of item are defined in <langinfo.h>. For exam‐
19 ple:
20
21
22 nl_langinfo(ABDAY_1)
23
24 would return a pointer to the string "Dom" if the identified language
25 was Portuguese, and "Sun" if the identified language was English.
26
27 Calls to setlocale() with a category corresponding to the category of
28 item (see <langinfo.h>), or to the category LC_ALL , may overwrite the
29 array pointed to by the return value.
30
31 The nl_langinfo() function need not be reentrant. A function that is
32 not required to be reentrant is not required to be thread-safe.
33
35 In a locale where langinfo data is not defined, nl_langinfo() shall
36 return a pointer to the corresponding string in the POSIX locale. In
37 all locales, nl_langinfo() shall return a pointer to an empty string if
38 item contains an invalid setting.
39
40 This pointer may point to static data that may be overwritten on the
41 next call.
42
44 No errors are defined.
45
46 The following sections are informative.
47
49 Getting Date and Time Formatting Information
50 The following example returns a pointer to a string containing date and
51 time formatting information, as defined in the LC_TIME category of the
52 current locale.
53
54
55 #include <time.h>
56 #include <langinfo.h>
57 ...
58 strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm);
59 ...
60
62 The array pointed to by the return value should not be modified by the
63 program, but may be modified by further calls to nl_langinfo().
64
66 None.
67
69 None.
70
72 setlocale() , the Base Definitions volume of IEEE Std 1003.1-2001,
73 Chapter 7, Locale, <langinfo.h>, <nl_types.h>
74
76 Portions of this text are reprinted and reproduced in electronic form
77 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
78 -- Portable Operating System Interface (POSIX), The Open Group Base
79 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
80 Electrical and Electronics Engineers, Inc and The Open Group. In the
81 event of any discrepancy between this version and the original IEEE and
82 The Open Group Standard, the original IEEE and The Open Group Standard
83 is the referee document. The original Standard can be obtained online
84 at http://www.opengroup.org/unix/online.html .
85
86
87
88IEEE/The Open Group 2003 NL_LANGINFO(P)