Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

3 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>Locale (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="Locale (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="Locale (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="index.html#Top" rel="up" title="Top">
  16. <link href="setlocale.html#setlocale" rel="next" title="setlocale">
  17. <link href="tzset.html#tzset" rel="prev" title="tzset">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="Locale"></a>
  48. <div class="header">
  49. <p>
  50. 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> &nbsp; [<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>
  51. </div>
  52. <hr>
  53. <a name="Locale-_0028locale_002eh_0029"></a>
  54. <h2 class="chapter">9 Locale (<samp>locale.h</samp>)</h2>
  55. <p>A <em>locale</em> is the name for a collection of parameters (affecting
  56. collating sequences and formatting conventions) that may be different
  57. depending on location or culture. The <code>&quot;C&quot;</code> locale is the only
  58. one defined in the ANSI C standard.
  59. </p>
  60. <p>This is a minimal implementation, supporting only the required <code>&quot;C&quot;</code>
  61. value for locale; strings representing other locales are not
  62. honored. (<code>&quot;&quot;</code> is also accepted; it represents the default locale
  63. for an implementation, here equivalent to <code>&quot;C&quot;</code>).
  64. </p>
  65. <p><samp>locale.h</samp> defines the structure <code>lconv</code> to collect the
  66. information on a locale, with the following fields:
  67. </p>
  68. <dl compact="compact">
  69. <dt><code>char *decimal_point</code></dt>
  70. <dd><p>The decimal point character used to format &ldquo;ordinary&rdquo; numbers (all
  71. numbers except those referring to amounts of money). <code>&quot;.&quot;</code> in the
  72. C locale.
  73. </p>
  74. </dd>
  75. <dt><code>char *thousands_sep</code></dt>
  76. <dd><p>The character (if any) used to separate groups of digits, when
  77. formatting ordinary numbers.
  78. <code>&quot;&quot;</code> in the C locale.
  79. </p>
  80. </dd>
  81. <dt><code>char *grouping</code></dt>
  82. <dd><p>Specifications for how many digits to group (if any grouping is done at
  83. all) when formatting ordinary numbers. The <em>numeric value</em> of each
  84. character in the string represents the number of digits for the next
  85. group, and a value of <code>0</code> (that is, the string&rsquo;s trailing
  86. <code>NULL</code>) means to continue grouping digits using the last value
  87. specified. Use <code>CHAR_MAX</code> to indicate that no further grouping is
  88. desired. <code>&quot;&quot;</code> in the C locale.
  89. </p>
  90. </dd>
  91. <dt><code>char *int_curr_symbol</code></dt>
  92. <dd><p>The international currency symbol (first three characters), if any, and
  93. the character used to separate it from numbers.
  94. <code>&quot;&quot;</code> in the C locale.
  95. </p>
  96. </dd>
  97. <dt><code>char *currency_symbol</code></dt>
  98. <dd><p>The local currency symbol, if any.
  99. <code>&quot;&quot;</code> in the C locale.
  100. </p>
  101. </dd>
  102. <dt><code>char *mon_decimal_point</code></dt>
  103. <dd><p>The symbol used to delimit fractions in amounts of money.
  104. <code>&quot;&quot;</code> in the C locale.
  105. </p>
  106. </dd>
  107. <dt><code>char *mon_thousands_sep</code></dt>
  108. <dd><p>Similar to <code>thousands_sep</code>, but used for amounts of money.
  109. <code>&quot;&quot;</code> in the C locale.
  110. </p>
  111. </dd>
  112. <dt><code>char *mon_grouping</code></dt>
  113. <dd><p>Similar to <code>grouping</code>, but used for amounts of money.
  114. <code>&quot;&quot;</code> in the C locale.
  115. </p>
  116. </dd>
  117. <dt><code>char *positive_sign</code></dt>
  118. <dd><p>A string to flag positive amounts of money when formatting.
  119. <code>&quot;&quot;</code> in the C locale.
  120. </p>
  121. </dd>
  122. <dt><code>char *negative_sign</code></dt>
  123. <dd><p>A string to flag negative amounts of money when formatting.
  124. <code>&quot;&quot;</code> in the C locale.
  125. </p>
  126. </dd>
  127. <dt><code>char int_frac_digits</code></dt>
  128. <dd><p>The number of digits to display when formatting amounts of money to
  129. international conventions.
  130. <code>CHAR_MAX</code> (the largest number representable as a <code>char</code>) in
  131. the C locale.
  132. </p>
  133. </dd>
  134. <dt><code>char frac_digits</code></dt>
  135. <dd><p>The number of digits to display when formatting amounts of money to
  136. local conventions.
  137. <code>CHAR_MAX</code> in the C locale.
  138. </p>
  139. </dd>
  140. <dt><code>char p_cs_precedes</code></dt>
  141. <dd><p><code>1</code> indicates the local currency symbol is used before a
  142. <em>positive or zero</em> formatted amount of money; <code>0</code> indicates
  143. the currency symbol is placed after the formatted number.
  144. <code>CHAR_MAX</code> in the C locale.
  145. </p>
  146. </dd>
  147. <dt><code>char p_sep_by_space</code></dt>
  148. <dd><p><code>1</code> indicates the local currency symbol must be separated from
  149. <em>positive or zero</em> numbers by a space; <code>0</code> indicates that it
  150. is immediately adjacent to numbers.
  151. <code>CHAR_MAX</code> in the C locale.
  152. </p>
  153. </dd>
  154. <dt><code>char n_cs_precedes</code></dt>
  155. <dd><p><code>1</code> indicates the local currency symbol is used before a
  156. <em>negative</em> formatted amount of money; <code>0</code> indicates
  157. the currency symbol is placed after the formatted number.
  158. <code>CHAR_MAX</code> in the C locale.
  159. </p>
  160. </dd>
  161. <dt><code>char n_sep_by_space</code></dt>
  162. <dd><p><code>1</code> indicates the local currency symbol must be separated from
  163. <em>negative</em> numbers by a space; <code>0</code> indicates that it
  164. is immediately adjacent to numbers.
  165. <code>CHAR_MAX</code> in the C locale.
  166. </p>
  167. </dd>
  168. <dt><code>char p_sign_posn</code></dt>
  169. <dd><p>Controls the position of the <em>positive</em> sign for
  170. numbers representing money. <code>0</code> means parentheses surround the
  171. number; <code>1</code> means the sign is placed before both the number and the
  172. currency symbol; <code>2</code> means the sign is placed after both the number
  173. and the currency symbol; <code>3</code> means the sign is placed just before
  174. the currency symbol; and <code>4</code> means the sign is placed just after
  175. the currency symbol.
  176. <code>CHAR_MAX</code> in the C locale.
  177. </p>
  178. </dd>
  179. <dt><code>char n_sign_posn</code></dt>
  180. <dd><p>Controls the position of the <em>negative</em> sign for numbers
  181. representing money, using the same rules as <code>p_sign_posn</code>.
  182. <code>CHAR_MAX</code> in the C locale.
  183. </p></dd>
  184. </dl>
  185. <table class="menu" border="0" cellspacing="0">
  186. <tr><td align="left" valign="top">&bull; <a href="setlocale.html#setlocale" accesskey="1">setlocale</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Select or query locale
  187. </td></tr>
  188. </table>
  189. <hr>
  190. <div class="header">
  191. <p>
  192. 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> &nbsp; [<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>
  193. </div>
  194. </body>
  195. </html>