You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
8.5 KiB
HTML
207 lines
8.5 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>Locale (The Red Hat newlib C Library)</title>
|
|
|
|
<meta name="description" content="Locale (The Red Hat newlib C Library)">
|
|
<meta name="keywords" content="Locale (The Red Hat newlib C Library)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
|
|
<link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="index.html#Top" rel="up" title="Top">
|
|
<link href="setlocale.html#setlocale" rel="next" title="setlocale">
|
|
<link href="tzset.html#tzset" rel="prev" title="tzset">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.indentedblock {margin-right: 0em}
|
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style: oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nolinebreak {white-space: nowrap}
|
|
span.roman {font-family: initial; font-weight: normal}
|
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<a name="Locale"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="Reentrancy.html#Reentrancy" accesskey="n" rel="next">Reentrancy</a>, Previous: <a href="Timefns.html#Timefns" accesskey="p" rel="prev">Timefns</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<a name="Locale-_0028locale_002eh_0029"></a>
|
|
<h2 class="chapter">9 Locale (<samp>locale.h</samp>)</h2>
|
|
|
|
<p>A <em>locale</em> is the name for a collection of parameters (affecting
|
|
collating sequences and formatting conventions) that may be different
|
|
depending on location or culture. The <code>"C"</code> locale is the only
|
|
one defined in the ANSI C standard.
|
|
</p>
|
|
<p>This is a minimal implementation, supporting only the required <code>"C"</code>
|
|
value for locale; strings representing other locales are not
|
|
honored. (<code>""</code> is also accepted; it represents the default locale
|
|
for an implementation, here equivalent to <code>"C"</code>).
|
|
</p>
|
|
|
|
<p><samp>locale.h</samp> defines the structure <code>lconv</code> to collect the
|
|
information on a locale, with the following fields:
|
|
</p>
|
|
<dl compact="compact">
|
|
<dt><code>char *decimal_point</code></dt>
|
|
<dd><p>The decimal point character used to format “ordinary” numbers (all
|
|
numbers except those referring to amounts of money). <code>"."</code> in the
|
|
C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *thousands_sep</code></dt>
|
|
<dd><p>The character (if any) used to separate groups of digits, when
|
|
formatting ordinary numbers.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *grouping</code></dt>
|
|
<dd><p>Specifications for how many digits to group (if any grouping is done at
|
|
all) when formatting ordinary numbers. The <em>numeric value</em> of each
|
|
character in the string represents the number of digits for the next
|
|
group, and a value of <code>0</code> (that is, the string’s trailing
|
|
<code>NULL</code>) means to continue grouping digits using the last value
|
|
specified. Use <code>CHAR_MAX</code> to indicate that no further grouping is
|
|
desired. <code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *int_curr_symbol</code></dt>
|
|
<dd><p>The international currency symbol (first three characters), if any, and
|
|
the character used to separate it from numbers.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *currency_symbol</code></dt>
|
|
<dd><p>The local currency symbol, if any.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *mon_decimal_point</code></dt>
|
|
<dd><p>The symbol used to delimit fractions in amounts of money.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *mon_thousands_sep</code></dt>
|
|
<dd><p>Similar to <code>thousands_sep</code>, but used for amounts of money.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *mon_grouping</code></dt>
|
|
<dd><p>Similar to <code>grouping</code>, but used for amounts of money.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *positive_sign</code></dt>
|
|
<dd><p>A string to flag positive amounts of money when formatting.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char *negative_sign</code></dt>
|
|
<dd><p>A string to flag negative amounts of money when formatting.
|
|
<code>""</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char int_frac_digits</code></dt>
|
|
<dd><p>The number of digits to display when formatting amounts of money to
|
|
international conventions.
|
|
<code>CHAR_MAX</code> (the largest number representable as a <code>char</code>) in
|
|
the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char frac_digits</code></dt>
|
|
<dd><p>The number of digits to display when formatting amounts of money to
|
|
local conventions.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char p_cs_precedes</code></dt>
|
|
<dd><p><code>1</code> indicates the local currency symbol is used before a
|
|
<em>positive or zero</em> formatted amount of money; <code>0</code> indicates
|
|
the currency symbol is placed after the formatted number.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char p_sep_by_space</code></dt>
|
|
<dd><p><code>1</code> indicates the local currency symbol must be separated from
|
|
<em>positive or zero</em> numbers by a space; <code>0</code> indicates that it
|
|
is immediately adjacent to numbers.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char n_cs_precedes</code></dt>
|
|
<dd><p><code>1</code> indicates the local currency symbol is used before a
|
|
<em>negative</em> formatted amount of money; <code>0</code> indicates
|
|
the currency symbol is placed after the formatted number.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char n_sep_by_space</code></dt>
|
|
<dd><p><code>1</code> indicates the local currency symbol must be separated from
|
|
<em>negative</em> numbers by a space; <code>0</code> indicates that it
|
|
is immediately adjacent to numbers.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char p_sign_posn</code></dt>
|
|
<dd><p>Controls the position of the <em>positive</em> sign for
|
|
numbers representing money. <code>0</code> means parentheses surround the
|
|
number; <code>1</code> means the sign is placed before both the number and the
|
|
currency symbol; <code>2</code> means the sign is placed after both the number
|
|
and the currency symbol; <code>3</code> means the sign is placed just before
|
|
the currency symbol; and <code>4</code> means the sign is placed just after
|
|
the currency symbol.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p>
|
|
</dd>
|
|
<dt><code>char n_sign_posn</code></dt>
|
|
<dd><p>Controls the position of the <em>negative</em> sign for numbers
|
|
representing money, using the same rules as <code>p_sign_posn</code>.
|
|
<code>CHAR_MAX</code> in the C locale.
|
|
</p></dd>
|
|
</dl>
|
|
|
|
<table class="menu" border="0" cellspacing="0">
|
|
<tr><td align="left" valign="top">• <a href="setlocale.html#setlocale" accesskey="1">setlocale</a>:</td><td> </td><td align="left" valign="top">Select or query locale
|
|
</td></tr>
|
|
</table>
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="Reentrancy.html#Reentrancy" accesskey="n" rel="next">Reentrancy</a>, Previous: <a href="Timefns.html#Timefns" accesskey="p" rel="prev">Timefns</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|