summaryrefslogtreecommitdiff
path: root/devdocs/c/locale%2Flc_categories.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/c/locale%2Flc_categories.html')
-rw-r--r--devdocs/c/locale%2Flc_categories.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/devdocs/c/locale%2Flc_categories.html b/devdocs/c/locale%2Flc_categories.html
new file mode 100644
index 00000000..a4a55fb5
--- /dev/null
+++ b/devdocs/c/locale%2Flc_categories.html
@@ -0,0 +1,50 @@
+ <h1 id="firstHeading" class="firstHeading">LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;locale.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define LC_ALL /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define LC_COLLATE /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define LC_CTYPE /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define LC_MONETARY /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define LC_NUMERIC /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define LC_TIME /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> </table> <p>Each of the above macro constants expand to integer constant expressions with distinct values that are suitable for use as the first argument of <code><a href="setlocale" title="c/locale/setlocale">setlocale</a></code>.</p>
+<table class="t-dsc-begin"> <tr class="t-dsc-hitem"> <th> Constant </th> <th> Explanation </th>
+</tr> <tr class="t-dsc"> <td> <code>LC_ALL</code> </td> <td> selects the entire C locale </td>
+</tr> <tr class="t-dsc"> <td> <code>LC_COLLATE</code> </td> <td> selects the collation category of the C locale </td>
+</tr> <tr class="t-dsc"> <td> <code>LC_CTYPE</code> </td> <td> selects the character classification category of the C locale </td>
+</tr> <tr class="t-dsc"> <td> <code>LC_MONETARY</code> </td> <td> selects the monetary formatting category of the C locale </td>
+</tr> <tr class="t-dsc"> <td> <code>LC_NUMERIC</code> </td> <td> selects the numeric formatting category of the C locale </td>
+</tr> <tr class="t-dsc"> <td> <code>LC_TIME</code> </td> <td> selects the time formatting category of the C locale </td>
+</tr> </table> <p>Additional macro constants, with names that begin with <code>LC_</code> followed by at least one uppercase letter, may be defined in <code>locale.h</code>. For example, the POSIX specification requires <code>LC_MESSAGES</code> (which controls, among other things, <code><a href="../io/perror" title="c/io/perror">perror</a></code> and <code><a href="../string/byte/strerror" title="c/string/byte/strerror">strerror</a></code>), ISO/IEC 30112:2014 (<a rel="nofollow" class="external text" href="https://www.open-std.org/JTC1/SC35/WG5/docs/30112d10.pdf">2014 draft</a>) additionally defines <code>LC_IDENTIFICATION</code>, <code>LC_XLITERATE</code>, <code>LC_NAME</code>, <code>LC_ADDRESS</code>, <code>LC_TELEPHONE</code>, <code>LC_PAPER</code>, <code>LC_MEASUREMENT</code>, and <code>LC_KEYBOARD</code>, which are supported by the GNU C library (except for <code>LC_XLITERATE</code>).</p>
+<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;locale.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;time.h&gt;
+#include &lt;wchar.h&gt;
+
+int main(void)
+{
+ setlocale(LC_ALL, "en_US.UTF-8"); // the C locale will be the UTF-8 enabled English
+ setlocale(LC_NUMERIC, "de_DE.utf8"); // decimal dot will be German
+ setlocale(LC_TIME, "ja_JP.utf8"); // date/time formatting will be Japanese
+ wchar_t str[100];
+ time_t t = time(NULL);
+ wcsftime(str, 100, L"%A %c", localtime(&amp;t));
+ wprintf(L"Number: %.2f\nDate: %Ls\n", 3.14, str);
+}</pre></div> <p>Possible output:</p>
+<div class="text source-text"><pre data-language="c">Number: 3,14
+Date: 金曜日 2023年09月15日 20時04分14秒</pre></div> </div> <h3 id="References"> References</h3> <ul>
+<li> C23 standard (ISO/IEC 9899:2023): </li>
+<ul><li> 7.11/3 Localization &lt;locale.h&gt; (p: TBD) </li></ul>
+<li> C17 standard (ISO/IEC 9899:2018): </li>
+<ul><li> 7.11/3 Localization &lt;locale.h&gt; (p: TBD) </li></ul>
+<li> C11 standard (ISO/IEC 9899:2011): </li>
+<ul><li> 7.11/3 Localization &lt;locale.h&gt; (p: 224) </li></ul>
+<li> C99 standard (ISO/IEC 9899:1999): </li>
+<ul><li> 7.11/3 Localization &lt;locale.h&gt; (p: 205) </li></ul>
+<li> C89/C90 standard (ISO/IEC 9899:1990): </li>
+<ul><li> 4.4 LOCALIZATION &lt;locale.h&gt; </li></ul>
+</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="setlocale" title="c/locale/setlocale"> <span class="t-lines"><span>setlocale</span></span></a></div> </td> <td> gets and sets the current C locale <br> <span class="t-mark">(function)</span> </td>
+</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/locale/LC_categories" title="cpp/locale/LC categories">C++ documentation</a></span> for <span class=""><span>locale categories</span></span> </td>
+</tr> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
+ <a href="https://en.cppreference.com/w/c/locale/LC_categories" class="_attribution-link">https://en.cppreference.com/w/c/locale/LC_categories</a>
+ </p>
+</div>