134 lines
6.0 KiB
HTML
134 lines
6.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
|
|
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>localeconv</title>
|
|
<link rel="stylesheet" href="ext.css" />
|
|
<link rel="stylesheet" href="site_modules.css" />
|
|
</head>
|
|
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-c_locale_localeconv skin-cppreference2 action-view cpp-navbar">
|
|
<div id="cpp-content-base">
|
|
<div id="content"><a id="top"></a>
|
|
<h1 id="firstHeading" class="firstHeading">localeconv</h1>
|
|
<div id="bodyContent">
|
|
<div id="contentSub"><span class="subpages">< <a href="c.html">c</a>‎ | <a href="c-locale.html">locale</a></span></div>
|
|
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
|
|
<table class="t-dcl-begin">
|
|
<tbody>
|
|
<tr class="t-dsc-header">
|
|
<td>
|
|
<div>定义于头文件 <code><locale.h></code></div>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr class="t-dcl">
|
|
<td class="t-dcl-nopad">
|
|
<div><span class="mw-geshi c source-c"><span class="kw1">struct</span> <a href="c-locale-lconv.html"><span class="kw902">lconv</span></a> <span class="sy2">*</span>localeconv<span class="br0">(</span><span class="kw4">void</span><span class="br0">)</span><span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td class="t-dcl-nopad"></td>
|
|
<td class="t-dcl-nopad"></td>
|
|
</tr>
|
|
<tr class="t-dcl-sep">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p><code>localeconv</code> 函数获得指向 <code>struct</code> <span class="t-lc"><a href="c-locale-lconv.html">lconv</a></span> 类型静态对象的指针,该对象表示当前 C 本地环境的数值和货币格式化规则。</p>
|
|
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">参数</span></h3>
|
|
<p>(无)</p>
|
|
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">返回值</span></h3>
|
|
<p>指向当前 <code>struct</code> <span class="t-lc"><a href="c-locale-lconv.html">lconv</a></span> 对象的指针。</p>
|
|
<h3><span class="mw-headline" id=".E6.B3.A8.E6.84.8F">注意</span></h3>
|
|
<p>通过返回的指针修改对象是未定义行为。</p>
|
|
<p><code>localeconv</code> 修改静态对象,从不同线程调用它而不同步是未定义行为。</p>
|
|
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">示例</span></h3>
|
|
<div class="t-example">
|
|
<div class="t-example-live-link"></div>
|
|
<div dir="ltr" class="mw-geshi" style="text-align: left;">
|
|
<div class="c source-c">
|
|
<pre class="de1"><span class="co2">#include <locale.h></span>
|
|
<span class="co2">#include <stdio.h></span>
|
|
|
|
<span class="kw4">int</span> main<span class="br0">(</span><span class="kw4">void</span><span class="br0">)</span>
|
|
<span class="br0">{</span>
|
|
<a href="c-locale-setlocale.html"><span class="kw901">setlocale</span></a><span class="br0">(</span><a href="c-locale-LC_categories.html"><span class="kw903">LC_ALL</span></a>, <span class="st0">"ja_JP.UTF-8"</span><span class="br0">)</span><span class="sy4">;</span>
|
|
<span class="kw1">struct</span> <a href="c-locale-lconv.html"><span class="kw902">lconv</span></a><span class="sy2">*</span> lc <span class="sy1">=</span> localeconv<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
|
|
<a href="c-io-fprintf.html"><span class="kw851">printf</span></a><span class="br0">(</span><span class="st0">"Japanese currency symbol: %s(%s)<span class="es1">\n</span>"</span>, lc<span class="sy2">-</span><span class="sy1">></span>currency_symbol, lc<span class="sy2">-</span><span class="sy1">></span>int_curr_symbol<span class="br0">)</span><span class="sy4">;</span>
|
|
<span class="br0">}</span></pre></div>
|
|
</div>
|
|
<p>输出:</p>
|
|
<div dir="ltr" class="mw-geshi" style="text-align: left;">
|
|
<div class="text source-text">
|
|
<pre class="de1">Japanese currency symbol: ¥(JPY)</pre></div>
|
|
</div>
|
|
</div>
|
|
<p><br /></p>
|
|
<h3><span class="mw-headline" id=".E5.BC.95.E7.94.A8">引用</span></h3>
|
|
<div class="t-ref-std-11">
|
|
<ul>
|
|
<li>C11 标准(ISO/IEC 9899:2011):</li>
|
|
</ul>
|
|
<dl>
|
|
<dd>
|
|
<ul>
|
|
<li>7.11.2.1 The localeconv function (p: 225-230)</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<div class="t-ref-std-c99">
|
|
<ul>
|
|
<li>C99 标准(ISO/IEC 9899:1999):</li>
|
|
</ul>
|
|
<dl>
|
|
<dd>
|
|
<ul>
|
|
<li>7.11.2.1 The localeconv function (p: 206-211)</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<div class="t-ref-std-c89">
|
|
<ul>
|
|
<li>C89/C90 标准(ISO/IEC 9899:1990):</li>
|
|
</ul>
|
|
<dl>
|
|
<dd>
|
|
<ul>
|
|
<li>4.4.2.1 The localeconv function</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">参阅</span></h3>
|
|
<table class="t-dsc-begin">
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="c-locale-setlocale.html"><span class="t-lines"><span>setlocale</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>获取和设置当前 C 本地环境<br />
|
|
<span class="t-mark">(函数)</span></td>
|
|
</tr>
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="c-locale-lconv.html"><span class="t-lines"><span>lconv</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td><span class="t-c"><span class="mw-geshi c source-c">localeconv</span></span> 所返回的格式化细节<br />
|
|
<span class="t-mark">(结构体)</span></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|