wcscmp -- Compare Wide-Character Strings

Format

#include <wcstr.h>
int wcscmp(const wchar_t *string1, const wchar_t *string2);

Language Level: XPG4
wcscmp compares two wide-character strings.

wcscmp operates on null-terminated wchar_t strings; string arguments to this function should contain a wchar_t null character marking the end of the string.

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

Value Meaning
Less than 0 string1 less than string2
0 string1 identical to string2
Greater than 0 string1 greater than string2.

Example
This example compares the wide-character string string1 to string2 using wcscmp.

#include <stdio.h>
#include <wcstr.h>
int main(void)
{
  int  result;
  wchar_t string1[] = L"abcdef";
  wchar_t string2[] = L"abcdefg";
  result = wcscmp( string1, string2 );
  if ( result == 0 )
    printf( "\"%ls\" is identical to \"%ls\"\n", string1, string2);
  else if ( result < 0 )
    printf( "\"%ls\" is less than \"%ls\"\n", string1, string2 );
  else
    printf( "\"%ls\" is greater than \"%ls\"\n", string1, string2);
  return 0;
  /****************************************************************
     The output should be:
     "abcdef" is less than "abcdefg"
  ****************************************************************/
}


strcmp -- Compare Strings
strcmpi -- Compare Strings Without Case Sensitivity
stricmp -- Compare Strings as Lowercase
strnicmp -- Compare Strings Without Case Sensitivity
wcscat -- Concatenate Wide-Character Strings
wcschr -- Search for Wide Character
wcscpy -- Copy Wide-Character Strings
wcscspn -- Find Offset of First Wide-Character Match
wcslen -- Calculate Length of Wide-Character String
wcsncmp -- Compare Wide-Character Strings
<wcstr.h>