1NL_LANGINFO(3P)            POSIX Programmer's Manual           NL_LANGINFO(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       nl_langinfo - language information
13

SYNOPSIS

15       #include <langinfo.h>
16
17       char *nl_langinfo(nl_item item);
18
19

DESCRIPTION

21       The nl_langinfo() function shall return a pointer to a string  contain‐
22       ing  information  relevant  to the particular language or cultural area
23       defined in the program's locale (see <langinfo.h>).  The manifest  con‐
24       stant  names and values of item are defined in <langinfo.h>.  For exam‐
25       ple:
26
27
28              nl_langinfo(ABDAY_1)
29
30       would return a pointer to the string "Dom" if the  identified  language
31       was Portuguese, and "Sun" if the identified language was English.
32
33       Calls  to  setlocale() with a category corresponding to the category of
34       item (see <langinfo.h>), or to the category LC_ALL , may overwrite  the
35       array pointed to by the return value.
36
37       The  nl_langinfo()  function  need not be reentrant. A function that is
38       not required to be reentrant is not required to be thread-safe.
39

RETURN VALUE

41       In a locale where langinfo data is  not  defined,  nl_langinfo()  shall
42       return  a  pointer  to the corresponding string in the POSIX locale. In
43       all locales, nl_langinfo() shall return a pointer to an empty string if
44       item contains an invalid setting.
45
46       This  pointer  may  point to static data that may be overwritten on the
47       next call.
48

ERRORS

50       No errors are defined.
51
52       The following sections are informative.
53

EXAMPLES

55   Getting Date and Time Formatting Information
56       The following example returns a pointer to a string containing date and
57       time  formatting information, as defined in the LC_TIME category of the
58       current locale.
59
60
61              #include <time.h>
62              #include <langinfo.h>
63              ...
64              strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm);
65              ...
66

APPLICATION USAGE

68       The array pointed to by the return value should not be modified by  the
69       program, but may be modified by further calls to nl_langinfo().
70

RATIONALE

72       None.
73

FUTURE DIRECTIONS

75       None.
76

SEE ALSO

78       setlocale(), the Base Definitions volume of IEEE Std 1003.1-2001, Chap‐
79       ter 7, Locale, <langinfo.h>, <nl_types.h>
80
82       Portions of this text are reprinted and reproduced in  electronic  form
83       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
84       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
85       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
86       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
87       event of any discrepancy between this version and the original IEEE and
88       The Open Group Standard, the original IEEE and The Open Group  Standard
89       is  the  referee document. The original Standard can be obtained online
90       at http://www.opengroup.org/unix/online.html .
91
92
93
94IEEE/The Open Group                  2003                      NL_LANGINFO(3P)
Impressum