diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/string%2Fwide%2Fwmemchr.html | |
new repository
Diffstat (limited to 'devdocs/c/string%2Fwide%2Fwmemchr.html')
| -rw-r--r-- | devdocs/c/string%2Fwide%2Fwmemchr.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fwide%2Fwmemchr.html b/devdocs/c/string%2Fwide%2Fwmemchr.html new file mode 100644 index 00000000..d2d9a2db --- /dev/null +++ b/devdocs/c/string%2Fwide%2Fwmemchr.html @@ -0,0 +1,51 @@ + <h1 id="firstHeading" class="firstHeading">wmemchr</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><wchar.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td> <pre data-language="c">wchar_t *wmemchr( const wchar_t *ptr, wchar_t ch, 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"> <td> <pre data-language="c">/*QWchar_t*/ *wmemchr( /*Qwchar_t*/ *ptr, wchar_t ch, size_t count );</pre> +</td> <td> (2) </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> </table> <div class="t-li1"> +<span class="t-li">1)</span> Locates the first occurrence of wide character <code>ch</code> in the initial <code>count</code> wide characters of the wide character array or integer array of compatible type, pointed to by <code>ptr</code>.</div> <div class="t-li1"> +<span class="t-li">2)</span> Type-generic function equivalent to <span class="t-v">(1)</span>. Let <code>T</code> be an unqualified wide character object type. <ul> +<li> If <code>ptr</code> is of type <code>const T*</code>, the return type is <code>const wchar_t*</code>. </li> +<li> Otherwise, if <code>ptr</code> is of type <code>T*</code>, the return type is <code>wchar_t*</code>. </li> +<li> Otherwise, the behavior is undefined. </li> +</ul> If a macro definition of each of these generic functions is suppressed to access an actual function (e.g. if <code>(wmemchr)</code> or a function pointer is used), the actual function declaration <span class="t-v">(1)</span> becomes visible.</div> <p>If <code>count</code> is zero, the function returns a null pointer.</p> +<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> ptr </td> <td> - </td> <td> pointer to the wide character array to be examined </td> +</tr> <tr class="t-par"> <td> ch </td> <td> - </td> <td> wide character to search for </td> +</tr> <tr class="t-par"> <td> count </td> <td> - </td> <td> number of wide characters to examine </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>Pointer to the location of the wide character, or a null pointer if no such character is found.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <locale.h> +#include <stdio.h> +#include <wchar.h> + +int main(void) +{ + wchar_t str[] = L"诺不轻信,故人不负我\0诺不轻许,故我不负人。"; + size_t sz = sizeof str / sizeof *str; + + wchar_t target = L'许'; + wchar_t* result = wmemchr(str, target, sz); + + if (result) + { + setlocale(LC_ALL, "en_US.utf8"); + printf("Found '%lc' at position %td\n",target, result - str); + } +}</pre></div> <p>Possible output:</p> +<div class="text source-text"><pre data-language="c">Found '许' at position 14</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C23 standard (ISO/IEC 9899:2023): </li> +<ul><li> 7.29.4.5.8 The wmemchr function (p: TBD) </li></ul> +<li> C17 standard (ISO/IEC 9899:2018): </li> +<ul><li> 7.29.4.5.8 The wmemchr function (p: TBD) </li></ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.29.4.5.8 The wmemchr function (p: 438) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.24.4.5.8 The wmemchr function (p: 384) </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="../byte/memchr" title="c/string/byte/memchr"> <span class="t-lines"><span>memchr</span></span></a></div> </td> <td> searches an array for the first occurrence of a character <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="wcschr" title="c/string/wide/wcschr"> <span class="t-lines"><span>wcschr</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> finds the first occurrence of a wide character in a wide string <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/wmemchr" title="cpp/string/wide/wmemchr">C++ documentation</a></span> for <code>wmemchr</code> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © 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/wmemchr" class="_attribution-link">https://en.cppreference.com/w/c/string/wide/wmemchr</a> + </p> +</div> |
