wmemcmp -- Compare Wide-Character Strings

Format

#include <wchar.h>
int *wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n);

Language Level: ANSI 93
wmemcmp compares the first n wide characters of the object pointed to by s1 to the first n wide characters of the object pointed to by s2.

If n has the value 0, wmemcmp returns 0.

Return Value
wmemcmp returns a value indicating the relationship between the two strings, as follows:

Value Meaning
Less than 0 s1 less than s2
0 s1 identical to s2
Greater than 0 s1 greater than s2

Example
This example compares the wide-character string in to out using wmemcmp.

#include <wchar.h>
#include <stdio.h>
main()
{
   int rc;
   wchar_t *in = L"12345678";
   wchar_t *out = L"12AAAAAB";
   printf("\nLESS is the expected result");
   rc = wmemcmp(in, out, 3);
   if (rc == 0)
      printf("\nArrays are EQUAL %ls %ls \n", in, out);
   else
   {
   if (rc > 0)
      printf("\nArray %ls GREATER than %ls \n", in, out);
   else
      printf("\nArray %ls LESS than %ls \n", in, out);
   }
   /******************************************************
      The output should be:
      LESS is the expected result
      Array 12345678 LESS than 12AAAAAB
   ******************************************************/
}



memcmp -- Compare Buffers
strcmp -- Compare Strings
strncmp -- Compare Strings
strcmpi -- Compare Strings Without Case Sensitivity
stricmp -- Compare Strings as Lowercase
strnicmp -- Compare Strings Without Case Sensitivity
wcscmp -- Compare Wide-Character Strings
wcsncmp -- Compare Wide-Character Strings
wmemchr -- Locate Wide Character in Wide-Character String
wmemcpy -- Copy Wide-Character Strings
wmemmove -- Copy Wide-Character Strings
wmemset -- Set Wide Characters to Value
<wchar.h>