Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/nl_langinfo.html
2024-02-19 00:21:47 -05:00

155 lines
5.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>nl_langinfo</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="nl_langinfo"></a> <a name="tag_03_407"></a><!-- nl_langinfo -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_407_01"></a>NAME</h4>
<blockquote>nl_langinfo - language information</blockquote>
<h4><a name="tag_03_407_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> #include &lt;<a href="../basedefs/langinfo.h.html">langinfo.h</a>&gt;<br>
<br>
char *nl_langinfo(nl_item</tt> <i>item</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_407_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>nl_langinfo</i>() function shall return a pointer to a string containing information relevant to the particular language
or cultural area defined in the program's locale (see <a href="../basedefs/langinfo.h.html"><i>&lt;langinfo.h&gt;</i></a>). The
manifest constant names and values of <i>item</i> are defined in <a href=
"../basedefs/langinfo.h.html"><i>&lt;langinfo.h&gt;</i></a>. For example:</p>
<pre>
<tt>nl_langinfo(ABDAY_1)
</tt>
</pre>
<p>would return a pointer to the string <tt>"Dom"</tt> if the identified language was Portuguese, and <tt>"Sun"</tt> if the
identified language was English.</p>
<p>Calls to <a href="../functions/setlocale.html"><i>setlocale</i>()</a> with a category corresponding to the category of
<i>item</i> (see <a href="../basedefs/langinfo.h.html"><i>&lt;langinfo.h&gt;</i></a>), or to the category <i>LC_ALL ,</i> may
overwrite the array pointed to by the return value.</p>
<p>The <i>nl_langinfo</i>() function need not be reentrant. A function that is not required to be reentrant is not required to be
thread-safe.</p>
</blockquote>
<h4><a name="tag_03_407_04"></a>RETURN VALUE</h4>
<blockquote>
<p>In a locale where <i>langinfo</i> data is not defined, <i>nl_langinfo</i>() shall return a pointer to the corresponding string
in the POSIX locale. In all locales, <i>nl_langinfo</i>() shall return a pointer to an empty string if <i>item</i> contains an
invalid setting.</p>
<p>This pointer may point to static data that may be overwritten on the next call.</p>
</blockquote>
<h4><a name="tag_03_407_05"></a>ERRORS</h4>
<blockquote>
<p>No errors are defined.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_407_06"></a>EXAMPLES</h4>
<blockquote>
<h5><a name="tag_03_407_06_01"></a>Getting Date and Time Formatting Information</h5>
<p>The following example returns a pointer to a string containing date and time formatting information, as defined in the
<i>LC_TIME</i> category of the current locale.</p>
<pre>
<tt>#include &lt;time.h&gt;
#include &lt;langinfo.h&gt;
...
strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm);
...
</tt>
</pre>
</blockquote>
<h4><a name="tag_03_407_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The array pointed to by the return value should not be modified by the program, but may be modified by further calls to
<i>nl_langinfo</i>().</p>
</blockquote>
<h4><a name="tag_03_407_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_407_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_407_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="setlocale.html"><i>setlocale</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../basedefs/xbd_chap07.html">Chapter 7, Locale</a>, <a href="../basedefs/langinfo.h.html"><i>&lt;langinfo.h&gt;</i></a>, <a href=
"../basedefs/nl_types.h.html"><i>&lt;nl_types.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_407_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 2.</p>
</blockquote>
<h4><a name="tag_03_407_12"></a>Issue 5</h4>
<blockquote>
<p>The last paragraph of the DESCRIPTION is moved from the APPLICATION USAGE section.</p>
<p>A note indicating that this function need not be reentrant is added to the DESCRIPTION.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>