wmemchr(3C) Standard C Library Functions wmemchr(3C)NAME
wmemchr - find a wide-character in memory
SYNOPSIS
#include <wchar.h>
wchar_t *wmemchr(const wchar_t *ws, wchar_t wc, size_t n);
ISO C++
#include <wchar.h>
const wchar_t *wmemchr(const wchar_t *ws, wchar_t wc, size_t n);
#include <cwchar>
wchar_t *std::wmemchr(wchar_t *ws, wchar_t wc, size_t n);
DESCRIPTION
The wmemchr() function locates the first occurrence of wc in the initial n wide-characters of the object pointed to be ws. This function is
not affected by locale and all wchar_t values are treated identically. The null wide-character and wchar_t values not corresponding to
valid characters are not treated specially.
If n is 0, ws must be a valid pointer and the function behaves as if no valid occurrence of wc is found.
RETURN VALUES
The wmemchr() function returns a pointer to the located wide-character, or a null pointer if the wide-character does not occur in the
object.
ERRORS
No errors are defined.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO wmemcmp(3C), wmemcpy(3C), wmemmove(3C), wmemset(3C), attributes(5), standards(5)SunOS 5.11 14 Aug 2002 wmemchr(3C)
Check Out this Related Man Page
wmemcpy(3) Library Functions Manual wmemcpy(3)NAME
wmemcpy, wmemchr, wmemcmp, wmemmove, wmemset - Perform memory operations on wide-character arrays
LIBRARY
Standard C Library (libc)
SYNOPSIS
#include <wchar.h>
wchar_t *wmemcpy(
wchar_t *wstr1,
const wchar_t *wstrs2,
size_t n);
wchar_t *wmemchr(
const wchar_t *wstr,
wchar_t wc,
size_t n);
int wmemcmp(
const wchar_t *wstr1,
const wchar_t *wstr2,
size_t n);
wchar_t *wmemmove(
wchar_t *wstr1,
const wchar_t *wstr2,
size_t n);
wchar_t *wmemset(
wchar_t *wstr,
wchar_t wc,
size_t n);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
wmemcpy(), wmemchr(), wmemcmp(), wmemmove(), wmemset(): XSH5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the location of a wide-character string. Points to the location of a destination wide-character string. Points to the location
of a source wide-character string. Specifies a wide character for which to search (except for the wmemset() case, in which wc is the tar-
get of the copy). Specifies the number of wide characters to search.
DESCRIPTION
The wmemcpy(), wmemchr(), wmemcmp(), wmemset(), and wmemmove() functions operate on wide-character strings in memory areas. A memory area
is a group of contiguous wide characters bound by a count and not terminated by a null wide character. These memory functions do not check
for overflow of the receiving memory area. They are also not affected by locale; therefore, they do not give special treatment to a null
wide character or wide-character values that do not correspond to valid multibyte characters. Unless stated otherwise, these functions
order two wide characters the same way as two integers of the integral type wchar_t. All of these memory functions are declared in the
wchar.h header file.
The wmemcpy() function copies n wide characters from the string pointed to by the wstr2 parameter into the location pointed to by the wstr1
parameter. When copying overlapping strings, the behavior of this function is unreliable.
The wmemchr() function sequentially searches the wide-character string at the location pointed to by the wstr parameter until one of the
following occurs: The wide character specified by the wc parameter has been found. The number of wide characters specified by the n param-
eter have been searched at location wstr.
If wc is found, the wmemchr() function returns a pointer to that wide character in the string pointed to by wstr. If wc is not found after
searching n wide characters, the function returns a null pointer.
The wmemcmp() function compares the first n wide characters of the string pointed to by the wstr1 parameter with the first n wide charac-
ters of the string pointed to by the wstr2 parameter.
This function returns one of the following values: Less than zero if the value of the object in wstr1 is less than the value of the object
in wstr2 Zero if the value of object in wstr1 is equal to the value of the object in wstr2 Greater than zero if the value of the object in
wstr1 is greater than the value of the object in wstr2
The wmemset() function first copies the value of the wide character specified by the wc parameter into each of the first n locations of the
string pointed to by the wstr parameter and then returns the value of wstr.
The wmemmove() function copies n wide characters from the string at the location pointed to by the wstr2 parameter to the string at the
location pointed to by the wstr1 parameter. Copying takes place as though the n wide characters from string wstr2 are first copied into a
temporary array having n wide characters that does not overlap either of the strings pointed to by wstr1 or wstr2. Then, n number of wide
characters from the temporary array are copied to the string pointed to by wstr1. Consequently, this operation is nondestructive and pro-
ceeds from left to right. The wmemmove() function returns the value of wstr1.
When the value of n is zero, all these functions either return zero or copy zero wide characters, depending on whether the purpose of the
function is to compare or copy wide characters.
RETURN VALUES
The wmemchr() function returns a pointer to the location of wc in wstr or a null pointer if wc is not found in the first n wide characters
of wstr.
The wmemcmp() function returns a value greater than, equal to, or less than 0 (zero), according to whether the first n wide characters of
the string pointed to by the wstr1 parameter have a value greater than, equal to, or less than the first n wide characters in the string
pointed to by the wstr2 parameter.
The wmemcpy() and wmemmove() functions return the wide-character string pointed to by the wstr1 parameter.
The wmemset() function returns the wide-character string pointed to by the wstr parameter.
RELATED INFORMATION
Functions: bcopy(3), memccpy(3), string(3), swab(3), wcscat(3), wcsspn(3), wcsstr(3), wcswcs(3) delim off
wmemcpy(3)