Name
wmemcmp
Synopsis
Compares two blocks of wide characters
#include <wchar.h> intwmemcmp
( const wchar_t * restrictb1
, const wchar_t * restrictb2
, size_tn
);
The wmemcmp()
function
compares the contents of two memory blocks of
n
wide characters, beginning at the
addresses in b1
and
b2
, until it finds a pair of wide
characters that don’t match. The function returns a value greater
than 0 if the mismatched wide character is greater in b1
, or less than 0 if the first mismatched
wide character is greater in b2
,
or 0 if the two buffers are identical over
n
wide characters.
Example
#define BUFFERSIZE 4096
wchar_t first[BUFFERSIZE] = { L'\0' };
wchar_t second[BUFFERSIZE] = { L'\0' };
/* ... read some data into the two buffers ... */
if (wmemcmp
( first, second, BUFFERSIZE ) == 0 )
printf( "The two buffers contain the same wide-character text.\n" );
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.