summaryrefslogtreecommitdiff
path: root/devdocs/c/string%2Fmultibyte%2Fc8rtomb.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/string%2Fmultibyte%2Fc8rtomb.html
new repository
Diffstat (limited to 'devdocs/c/string%2Fmultibyte%2Fc8rtomb.html')
-rw-r--r--devdocs/c/string%2Fmultibyte%2Fc8rtomb.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fmultibyte%2Fc8rtomb.html b/devdocs/c/string%2Fmultibyte%2Fc8rtomb.html
new file mode 100644
index 00000000..3060f056
--- /dev/null
+++ b/devdocs/c/string%2Fmultibyte%2Fc8rtomb.html
@@ -0,0 +1,23 @@
+ <h1 id="firstHeading" class="firstHeading">c8rtomb</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;uchar.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">size_t c8rtomb( char* restrict s, char8_t c8, mbstate_t* restrict ps );</pre>
+</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> </table> <p>Converts a single code point from UTF-8 to a narrow multibyte character representation.</p>
+<p>If <code>s</code> is not a null pointer and <code>c8</code> is the last code unit in a valid UTF-8 encoding of a code point, the function determines the number of bytes necessary to store the multibyte character representation of that code point (including any shift sequences, and taking into account the current multibyte conversion state <code>*ps</code>), and stores the multibyte character representation in the character array whose first element is pointed to by <code>s</code>, updating <code>*ps</code> as necessary. At most <code>MB_CUR_MAX</code> bytes can be written by this function.</p>
+<p>If <code>c8</code> is not the final UTF-8 code unit in a representation of a code point, the function does not write to the array pointed to by <code>s</code>, only <code>*ps</code> is updated.</p>
+<p>If <code>s</code> is a null pointer, the call is equivalent to <code>c8rtomb(buf, u8'\0', ps)</code> for some internal buffer <code>buf</code>.</p>
+<p>If <code>c8</code> is the null character <code>u8'\0'</code>, a null byte is stored, preceded by any shift sequence necessary to restore the initial shift state and the conversion state parameter <code>*ps</code> is updated to represent the initial shift state.</p>
+<p>The multibyte encoding used by this function is specified by the currently active C locale.</p>
+<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> s </td> <td> - </td> <td> pointer to narrow character array where the multibyte character will be stored </td>
+</tr> <tr class="t-par"> <td> c8 </td> <td> - </td> <td> the UTF-8 code unit to convert </td>
+</tr> <tr class="t-par"> <td> ps </td> <td> - </td> <td> pointer to the conversion state object used when interpreting the multibyte string </td>
+</tr>
+</table> <h3 id="Return_value"> Return value</h3> <p>The number of bytes stored in the array object (including any shift sequences). This may be zero when <code>c8</code> is not the final code unit in the UTF-8 representation of a code point.</p>
+<p>If <code>c8</code> is invalid (does not contribute to a sequence of <code>char8_t</code> corresponding to a valid multibyte character), the value of the macro <code><a href="../../error/errno_macros" title="c/error/errno macros">EILSEQ</a></code> is stored in <code><a href="../../error/errno" title="c/error/errno">errno</a></code>, <code><span class="br0">(</span><a href="http://en.cppreference.com/w/c/types/size_t"><span class="kw100">size_t</span></a><span class="br0">)</span><span class="sy2">-</span><span class="nu0">1</span></code> is returned, and the conversion state is unspecified.</p>
+<h3 id="Notes"> Notes</h3> <p>Calls to <code>c8rtomb</code> with a null pointer argument for <code>s</code> may introduce a data race with other calls to <code>c8rtomb</code> with a null pointer argument for <code>s</code>.</p>
+<h3 id="Example"> Example</h3> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="mbrtoc8" title="c/string/multibyte/mbrtoc8"> <span class="t-lines"><span>mbrtoc8</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c23">(C23)</span></span></span></div> </td> <td> converts a narrow multibyte character to UTF-8 encoding <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/string/multibyte/c8rtomb" title="cpp/string/multibyte/c8rtomb">C++ documentation</a></span> for <code>c8rtomb</code> </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/string/multibyte/c8rtomb" class="_attribution-link">https://en.cppreference.com/w/c/string/multibyte/c8rtomb</a>
+ </p>
+</div>