📄 localeconv.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-2003 The Open Group, All Rights Reserved --><title>localeconv</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="localeconv"></a> <a name="tag_03_340"></a><!-- localeconv --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_340_01"></a>NAME</h4><blockquote>localeconv - return locale-specific information</blockquote><h4><a name="tag_03_340_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>#include <<a href="../basedefs/locale.h.html">locale.h</a>><br><br> struct lconv *localeconv(void);<br></tt></code></p></blockquote><h4><a name="tag_03_340_03"></a>DESCRIPTION</h4><blockquote><div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> The functionality described on this reference page is aligned with the ISO C standard. Any conflict between therequirements described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 defers tothe ISO C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div><p>The <i>localeconv</i>() function shall set the components of an object with the type <b>struct lconv</b> with the valuesappropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale.</p><p>The members of the structure with type <b>char *</b> are pointers to strings, any of which (except <b>decimal_point</b>) canpoint to <tt>""</tt> , to indicate that the value is not available in the current locale or is of zero length. The members withtype <b>char</b> are non-negative numbers, any of which can be {CHAR_MAX} to indicate that the value is not available in thecurrent locale.</p><p>The members include the following:</p><dl compact><dt><b>char *decimal_point</b></dt><dd><br>The radix character used to format non-monetary quantities.</dd><dt><b>char *thousands_sep</b></dt><dd><br>The character used to separate groups of digits before the decimal-point character in formatted non-monetary quantities.</dd><dt><b>char *grouping</b></dt><dd><br>A string whose elements taken as one-byte integer values indicate the size of each group of digits in formatted non-monetaryquantities.</dd><dt><b>char *int_curr_symbol</b></dt><dd><br>The international currency symbol applicable to the current locale. The first three characters contain the alphabetic internationalcurrency symbol in accordance with those specified in the ISO 4217:1995 standard. The fourth character (immediately precedingthe null byte) is the character used to separate the international currency symbol from the monetary quantity.</dd><dt><b>char *currency_symbol</b></dt><dd><br>The local currency symbol applicable to the current locale.</dd><dt><b>char *mon_decimal_point</b></dt><dd><br>The radix character used to format monetary quantities.</dd><dt><b>char *mon_thousands_sep</b></dt><dd><br>The separator for groups of digits before the decimal-point in formatted monetary quantities.</dd><dt><b>char *mon_grouping</b></dt><dd><br>A string whose elements taken as one-byte integer values indicate the size of each group of digits in formatted monetaryquantities.</dd><dt><b>char *positive_sign</b></dt><dd><br>The string used to indicate a non-negative valued formatted monetary quantity.</dd><dt><b>char *negative_sign</b></dt><dd><br>The string used to indicate a negative valued formatted monetary quantity.</dd><dt><b>char int_frac_digits</b></dt><dd><br>The number of fractional digits (those after the decimal-point) to be displayed in an internationally formatted monetaryquantity.</dd><dt><b>char frac_digits</b></dt><dd><br>The number of fractional digits (those after the decimal-point) to be displayed in a formatted monetary quantity.</dd><dt><b>char p_cs_precedes</b></dt><dd><br>Set to 1 if the <b>currency_symbol</b> precedes the value for a non-negative formatted monetary quantity. Set to 0 if the symbolsucceeds the value.</dd><dt><b>char p_sep_by_space</b></dt><dd><br>Set to a value indicating the separation of the <b>currency_symbol</b>, the sign string, and the value for a non-negative formattedmonetary quantity.</dd><dt><b>char n_cs_precedes</b></dt><dd><br>Set to 1 if the <b>currency_symbol</b> precedes the value for a negative formatted monetary quantity. Set to 0 if the symbolsucceeds the value.</dd><dt><b>char n_sep_by_space</b></dt><dd><br>Set to a value indicating the separation of the <b>currency_symbol</b>, the sign string, and the value for a negative formattedmonetary quantity.</dd><dt><b>char p_sign_posn</b></dt><dd><br>Set to a value indicating the positioning of the <b>positive_sign</b> for a non-negative formatted monetary quantity.</dd><dt><b>char n_sign_posn</b></dt><dd><br>Set to a value indicating the positioning of the <b>negative_sign</b> for a negative formatted monetary quantity.</dd><dt><b>char int_p_cs_precedes</b></dt><dd><br>Set to 1 or 0 if the <b>int_curr_symbol</b> respectively precedes or succeeds the value for a non-negative internationallyformatted monetary quantity.</dd><dt><b>char int_n_cs_precedes</b></dt><dd><br>Set to 1 or 0 if the <b>int_curr_symbol</b> respectively precedes or succeeds the value for a negative internationally formattedmonetary quantity.</dd><dt><b>char int_p_sep_by_space</b></dt><dd><br>Set to a value indicating the separation of the <b>int_curr_symbol</b>, the sign string, and the value for a non-negativeinternationally formatted monetary quantity.</dd><dt><b>char int_n_sep_by_space</b></dt><dd><br>Set to a value indicating the separation of the <b>int_curr_symbol</b>, the sign string, and the value for a negativeinternationally formatted monetary quantity.</dd><dt><b>char int_p_sign_posn</b></dt><dd><br>Set to a value indicating the positioning of the <b>positive_sign</b> for a non-negative internationally formatted monetaryquantity.</dd><dt><b>char int_n_sign_posn</b></dt><dd><br>Set to a value indicating the positioning of the <b>negative_sign</b> for a negative internationally formatted monetaryquantity.</dd></dl><p>The elements of <b>grouping</b> and <b>mon_grouping</b> are interpreted according to the following:</p><dl compact><dt>{CHAR_MAX}</dt><dd>No further grouping is to be performed.</dd><dt>0</dt><dd>The previous element is to be repeatedly used for the remainder of the digits.</dd><dt><i>other</i></dt><dd>The integer value is the number of digits that comprise the current group. The next element is examined to determine the sizeof the next group of digits before the current group.</dd></dl><p>The values of <b>p_sep_by_space</b>, <b>n_sep_by_space</b>, <b>int_p_sep_by_space</b>, and <b>int_n_sep_by_space</b> areinterpreted according to the following:</p><dl compact><dt>0</dt><dd>No space separates the currency symbol and value.</dd><dt>1</dt><dd>If the currency symbol and sign string are adjacent, a space separates them from the value; otherwise, a space separates thecurrency symbol from the value.</dd><dt>2</dt><dd>If the currency symbol and sign string are adjacent, a space separates them; otherwise, a space separates the sign string fromthe value.</dd></dl><p>For <b>int_p_sep_by_space</b> and <b>int_n_sep_by_space</b>, the fourth character of <b>int_curr_symbol</b> is used instead of aspace.</p><p>The values of <b>p_sign_posn</b>, <b>n_sign_posn</b>, <b>int_p_sign_posn</b>, and <b>int_n_sign_posn</b> are interpretedaccording to the following:</p><dl compact><dt>0</dt><dd>Parentheses surround the quantity and <b>currency_symbol</b> or <b>int_curr_symbol</b>.</dd><dt>1</dt><dd>The sign string precedes the quantity and <b>currency_symbol</b> or <b>int_curr_symbol</b>.</dd><dt>2</dt><dd>The sign string succeeds the quantity and <b>currency_symbol</b> or <b>int_curr_symbol</b>.</dd><dt>3</dt><dd>The sign string immediately precedes the <b>currency_symbol</b> or <b>int_curr_symbol</b>.</dd><dt>4</dt><dd>The sign string immediately succeeds the <b>currency_symbol</b> or <b>int_curr_symbol</b>.</dd></dl><p>The implementation shall behave as if no function in this volume of IEEE Std 1003.1-2001 calls<i>localeconv</i>().</p><p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The<i>localeconv</i>() function need not be reentrant. A function that is not required to be reentrant is not required to bethread-safe. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_340_04"></a>RETURN VALUE</h4><blockquote><p>The <i>localeconv</i>() function shall return a pointer to the filled-in object. The application shall not modify the structurepointed to by the return value which may be overwritten by a subsequent call to <i>localeconv</i>(). In addition, calls to <a href="../functions/setlocale.html"><i>setlocale</i>()</a> with the categories <i>LC_ALL ,</i> <i>LC_MONETARY ,</i> or <i>LC_NUMERIC</i>may overwrite the contents of the structure.</p></blockquote><h4><a name="tag_03_340_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_340_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_340_07"></a>APPLICATION USAGE</h4><blockquote><p>The following table illustrates the rules which may be used by four countries to format monetary quantities.</p><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Country</b></p></th><th align="center"><p class="tent"><b>Positive Format</b></p></th><th align="center"><p class="tent"><b>Negative Format</b></p></th><th align="center"><p class="tent"><b>International Format</b></p></th></tr><tr valign="top"><td align="left"><p class="tent">Italy</p></td><td align="left"><p class="tent">L.1.230</p></td><td align="left"><p class="tent">-L.1.230</p></td><td align="left"><p class="tent">ITL.1.230</p></td></tr><tr valign="top"><td align="left"><p class="tent">Netherlands</p></td><td align="left"><p class="tent">F 1.234,56</p></td><td align="left"><p class="tent">F -1.234,56</p></td><td align="left"><p class="tent">NLG 1.234,56</p></td></tr><tr valign="top"><td align="left"><p class="tent">Norway</p></td><td align="left"><p class="tent">kr1.234,56</p></td><td align="left"><p class="tent">kr1.234,56-</p></td><td align="left"><p class="tent">NOK 1.234,56</p></td></tr><tr valign="top"><td align="left"><p class="tent">Switzerland</p></td><td align="left"><p class="tent">SFrs.1,234.56</p></td><td align="left"><p class="tent">SFrs.1,234.56C</p></td><td align="left"><p class="tent">CHF 1,234.56</p></td></tr></table></center><p>For these four countries, the respective values for the monetary members of the structure returned by <i>localeconv</i>()are:</p><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b> </b></p></th><th align="center"><p class="tent"><b>Italy</b></p></th><th align="center"><p class="tent"><b>Netherlands</b></p></th><th align="center"><p class="tent"><b>Norway</b></p></th><th align="center"><p class="tent"><b>Switzerland</b></p></th></tr><tr valign="top"><td align="left"><p class="tent"><b>int_curr_symbol</b></p></td><td align="center"><p class="tent">"ITL."</p></td><td align="center"><p class="tent">"NLG "</p></td><td align="center"><p class="tent">"NOK "</p></td><td align="center"><p class="tent">"CHF "</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>currency_symbol</b></p></td><td align="center"><p class="tent">"L."</p></td><td align="center"><p class="tent">"F"</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -