1<html lang="en"> 2<head> 3<title>Locale - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Timefns.html#Timefns" title="Timefns"> 9<link rel="next" href="Reentrancy.html#Reentrancy" title="Reentrancy"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<meta http-equiv="Content-Style-Type" content="text/css"> 12<style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22--></style> 23<link rel="stylesheet" type="text/css" href="../cs.css"> 24</head> 25<body> 26<div class="node"> 27<a name="Locale"></a> 28<p> 29Next: <a rel="next" accesskey="n" href="Reentrancy.html#Reentrancy">Reentrancy</a>, 30Previous: <a rel="previous" accesskey="p" href="Timefns.html#Timefns">Timefns</a>, 31Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 32<hr> 33</div> 34 35<h2 class="chapter">9 Locale (<samp><span class="file">locale.h</span></samp>)</h2> 36 37<p>A <dfn>locale</dfn> is the name for a collection of parameters (affecting 38collating sequences and formatting conventions) that may be different 39depending on location or culture. The <code>"C"</code> locale is the only 40one defined in the ANSI C standard. 41 42 <p>This is a minimal implementation, supporting only the required <code>"C"</code> 43value for locale; strings representing other locales are not 44honored. (<code>""</code> is also accepted; it represents the default locale 45for an implementation, here equivalent to <code>"C"</code>. 46 47 <p><samp><span class="file">locale.h</span></samp> defines the structure <code>lconv</code> to collect the 48information on a locale, with the following fields: 49 50 <dl> 51<dt><code>char *decimal_point</code><dd>The decimal point character used to format “ordinary” numbers (all 52numbers except those referring to amounts of money). <code>"."</code> in the 53C locale. 54 55 <br><dt><code>char *thousands_sep</code><dd>The character (if any) used to separate groups of digits, when 56formatting ordinary numbers. 57<code>""</code> in the C locale. 58 59 <br><dt><code>char *grouping</code><dd>Specifications for how many digits to group (if any grouping is done at 60all) when formatting ordinary numbers. The <em>numeric value</em> of each 61character in the string represents the number of digits for the next 62group, and a value of <code>0</code> (that is, the string's trailing 63<code>NULL</code>) means to continue grouping digits using the last value 64specified. Use <code>CHAR_MAX</code> to indicate that no further grouping is 65desired. <code>""</code> in the C locale. 66 67 <br><dt><code>char *int_curr_symbol</code><dd>The international currency symbol (first three characters), if any, and 68the character used to separate it from numbers. 69<code>""</code> in the C locale. 70 71 <br><dt><code>char *currency_symbol</code><dd>The local currency symbol, if any. 72<code>""</code> in the C locale. 73 74 <br><dt><code>char *mon_decimal_point</code><dd>The symbol used to delimit fractions in amounts of money. 75<code>""</code> in the C locale. 76 77 <br><dt><code>char *mon_thousands_sep</code><dd>Similar to <code>thousands_sep</code>, but used for amounts of money. 78<code>""</code> in the C locale. 79 80 <br><dt><code>char *mon_grouping</code><dd>Similar to <code>grouping</code>, but used for amounts of money. 81<code>""</code> in the C locale. 82 83 <br><dt><code>char *positive_sign</code><dd>A string to flag positive amounts of money when formatting. 84<code>""</code> in the C locale. 85 86 <br><dt><code>char *negative_sign</code><dd>A string to flag negative amounts of money when formatting. 87<code>""</code> in the C locale. 88 89 <br><dt><code>char int_frac_digits</code><dd>The number of digits to display when formatting amounts of money to 90international conventions. 91<code>CHAR_MAX</code> (the largest number representable as a <code>char</code>) in 92the C locale. 93 94 <br><dt><code>char frac_digits</code><dd>The number of digits to display when formatting amounts of money to 95local conventions. 96<code>CHAR_MAX</code> in the C locale. 97 98 <br><dt><code>char p_cs_precedes</code><dd><code>1</code> indicates the local currency symbol is used before a 99<em>positive or zero</em> formatted amount of money; <code>0</code> indicates 100the currency symbol is placed after the formatted number. 101<code>CHAR_MAX</code> in the C locale. 102 103 <br><dt><code>char p_sep_by_space</code><dd><code>1</code> indicates the local currency symbol must be separated from 104<em>positive or zero</em> numbers by a space; <code>0</code> indicates that it 105is immediately adjacent to numbers. 106<code>CHAR_MAX</code> in the C locale. 107 108 <br><dt><code>char n_cs_precedes</code><dd><code>1</code> indicates the local currency symbol is used before a 109<em>negative</em> formatted amount of money; <code>0</code> indicates 110the currency symbol is placed after the formatted number. 111<code>CHAR_MAX</code> in the C locale. 112 113 <br><dt><code>char n_sep_by_space</code><dd><code>1</code> indicates the local currency symbol must be separated from 114<em>negative</em> numbers by a space; <code>0</code> indicates that it 115is immediately adjacent to numbers. 116<code>CHAR_MAX</code> in the C locale. 117 118 <br><dt><code>char p_sign_posn</code><dd>Controls the position of the <em>positive</em> sign for 119numbers representing money. <code>0</code> means parentheses surround the 120number; <code>1</code> means the sign is placed before both the number and the 121currency symbol; <code>2</code> means the sign is placed after both the number 122and the currency symbol; <code>3</code> means the sign is placed just before 123the currency symbol; and <code>4</code> means the sign is placed just after 124the currency symbol. 125<code>CHAR_MAX</code> in the C locale. 126 127 <br><dt><code>char n_sign_posn</code><dd>Controls the position of the <em>negative</em> sign for numbers 128representing money, using the same rules as <code>p_sign_posn</code>. 129<code>CHAR_MAX</code> in the C locale. 130</dl> 131 132<ul class="menu"> 133<li><a accesskey="1" href="setlocale.html#setlocale">setlocale</a>: Select or query locale 134</ul> 135 136 </body></html> 137 138