wmemcpy(3)wmemcpy(3)NAME
wmemcpy, wmemchr, wmemcmp, wmemmove, wmemset - Perform memory opera‐
tions on wide-character arrays
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 );
LIBRARY
Standard C Library (libc)
STANDARDS
Interfaces documented on this reference page conform to industry stan‐
dards 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 loca‐
tion 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 target of
the copy). Specifies the number of wide characters to search.
DESCRIPTION
The wmemcpy(), wmemchr(), wmemcmp(), wmemset(), and wmemmove() func‐
tions operate on wide-character strings in memory areas. A memory area
is a group of contiguous wide characters bound by a count and not ter‐
minated 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 func‐
tion is unreliable.
The wmemchr() function sequentially searches the wide-character string
at the location pointed to by the wstr parameter until one of the fol‐
lowing occurs: The wide character specified by the wc parameter has
been found. The number of wide characters specified by the n parameter
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 loca‐
tion pointed to by the wstr1 parameter. Copying takes place as though
the n wide characters from string wstr2 are first copied into a tempo‐
rary 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 proceeds 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.
SEE ALSO
Functions: bcopy(3), memccpy(3), string(3), swab(3), wcscat(3),
wcsspn(3), wcsstr(3), wcswcs(3)wmemcpy(3)