summaryrefslogtreecommitdiff
path: root/devdocs/c/string%2Fwide%2Fwmemmove.html
blob: 5b6a969c6f1eb893345a21be427f698167f0f637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    <h1 id="firstHeading" class="firstHeading">wmemmove, wmemmove_s</h1>            <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;wchar.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c95"> <td> <pre data-language="c">wchar_t* wmemmove( wchar_t* dest, const wchar_t* src, size_t count );</pre>
</td> <td> (1) </td> <td> <span class="t-mark-rev t-since-c95">(since C95)</span> </td> </tr> <tr class="t-dcl t-since-c11"> <td> <pre data-language="c">errno_t wmemmove_s( wchar_t *dest, rsize_t destsz,
                    const wchar_t *src, rsize_t count);</pre>
</td> <td> (2) </td> <td> <span class="t-mark-rev t-since-c11">(since C11)</span> </td> </tr>  </table> <div class="t-li1">
<span class="t-li">1)</span> Copies exactly <code>count</code> successive wide characters from the wide character array pointed to by <code>src</code> to the wide character array pointed to by <code>dest</code>. If <code>count</code> is zero, the function does nothing. The arrays may overlap: copying takes place as if the wide characters were copied to a temporary wide character array and then copied from the temporary array to <code>dest</code>.</div> <div class="t-li1">
<span class="t-li">2)</span> Same as <span class="t-v">(1)</span>, except that the following errors are detected at runtime and call the currently installed <a href="../../error/set_constraint_handler_s" title="c/error/set constraint handler s">constraint handler</a> function: <dl>
<dd>
<ul>
<li> <code>src</code> or <code>dest</code> is a null pointer </li>
<li> <code>destsz</code> or <code>count</code> is greater than <code>RSIZE_MAX / sizeof(wchar_t)</code> </li>
<li> <code>count</code> is greater than <code>destsz</code> (overflow would occur) </li>
</ul> </dd>
<dd>As with all bounds-checked functions, <code>wmemcpy_s</code> only guaranteed to be available if <code>__STDC_LIB_EXT1__</code> is defined by the implementation and if the user defines <code>__STDC_WANT_LIB_EXT1__</code> to the integer constant <code>1</code> before including <a href="../wide" title="c/string/wide"><code>&lt;wchar.h&gt;</code></a>.</dd>
</dl>
</div>  <h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> dest </td> <td> - </td> <td> pointer to the wide character array to copy to </td>
</tr> <tr class="t-par"> <td> src </td> <td> - </td> <td> pointer to the wide character array to copy from </td>
</tr> <tr class="t-par"> <td> destsz </td> <td> - </td> <td> max number of wide characters to write (the size of the destination buffer) </td>
</tr> <tr class="t-par"> <td> count </td> <td> - </td> <td> number of wide characters to copy </td>
</tr>
</table> <h3 id="Return_value"> Return value</h3> <div class="t-li1">
<span class="t-li">1)</span> Returns a copy of <code>dest</code>
</div> <div class="t-li1">
<span class="t-li">2)</span> Returns zero on success, returns non-zero on error. Also, on error, fills the entire <code>dst</code> up to and not including <code>dst+dstsz</code> with null wide characters, <code>L'\0'</code> (unless <code>dest</code> is null or <code>destsz</code> is greater than <code>RSIZE_MAX/sizeof(wchar_t)</code>)</div> <h3 id="Notes"> Notes</h3> <p>This function is not locale-sensitive and pays no attention to the values of the <code>wchar_t</code> objects it copies: nulls as well as invalid characters are copied too.</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;wchar.h&gt;
 
int main(void)
{
    setlocale(LC_ALL, "en_US.utf8");
 
    wchar_t str[] = L"αβγδεζηθικλμνξοπρστυφχψω";
    printf("%ls\n", str);
    wmemmove(str + 4, str + 3, 3); // copy from [δεζ] to [εζη]
    printf("%ls\n", str);
}</pre></div> <p>Output:</p>
<div class="text source-text"><pre data-language="c">αβγδεζηθικλμνξοπρστυφχψω
αβγδδεζθικλμνξοπρστυφχψω</pre></div> </div> <h3 id="References"> References</h3>  <ul>
<li> C23 standard (ISO/IEC 9899:2023): </li>
<ul>
<li> 7.29.4.2.4 The wmemmove function (p: TBD) </li>
<li> K.3.9.2.1.4 The wmemmove_s function (p: TBD) </li>
</ul>
<li> C17 standard (ISO/IEC 9899:2018): </li>
<ul>
<li> 7.29.4.2.4 The wmemmove function (p: TBD) </li>
<li> K.3.9.2.1.4 The wmemmove_s function (p: TBD) </li>
</ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul>
<li> 7.29.4.2.4 The wmemmove function (p: 432) </li>
<li> K.3.9.2.1.4 The wmemmove_s function (p: 642) </li>
</ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul><li> 7.24.4.2.4 The wmemmove function (p: 378) </li></ul>
</ul>                  <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="../byte/memmove" title="c/string/byte/memmove"> <span class="t-lines"><span>memmove</span><span>memmove_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> moves one buffer to another <br> <span class="t-mark">(function)</span>  </td>
</tr> <tr class="t-dsc"> <td> <div><a href="wmemcpy" title="c/string/wide/wmemcpy"> <span class="t-lines"><span>wmemcpy</span><span>wmemcpy_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> copies a certain amount of wide characters between two non-overlapping arrays <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/wide/wmemmove" title="cpp/string/wide/wmemmove">C++ documentation</a></span> for <code>wmemmove</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/wide/wmemmove" class="_attribution-link">https://en.cppreference.com/w/c/string/wide/wmemmove</a>
  </p>
</div>