Syntax
#include <wchar.h> int wcscmp(const wchar_t *string1, const wchar_t *string2);Description
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. Boundary checking is not performed when a string is added to or copied.
wcscmp returns a value indicating the relationship between the two strings, as follows: compact break=fit.
Value
This example compares the wide-character string string1 to string2 using wcscmp.
#include <stdio.h>#include <wchar.h>
int main(void)
{
int result;
wchar_t string1[] = L"abcdef";
wchar_t string2[] = L"abcdefg";
result = wcscmp(string1, string2);
if (0 == result)
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"
****************************************************************************/
}
Related Information