Previous Page
Next Page


Compares two blocks of wide characters

#include <wchar.h>
int wmemcmp ( const wchar_t * restrict b1 , const wchar_t * restrict b2 ,
             size_t n  );

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 (evaluated as unsigned char) 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.


#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" );

See Also

wcscmp( ), memcmp( ), strcmp( )

Previous Page
Next Page