Compares the first n wide characters of two strings #include <wchar.h> int wcsncmp ( const wchar_t *s1 , const wchar_t *s2 , size_t n ); The wcsncmp( ) function compares at most the first n wide characters in the two strings addressed by its pointer arguments. Characters that follow a null wide character are ignored. wcsncmp( ) returns a value indicating the result as follows:
Examplewchar_t *months[ ] = { L"January", L"February", L"March", L"April", L"May", L"June", L"July", L"August", L"September", L"October", L"November", L"December" }; wchar_t date[ ] = L"Thu, 10 Mar 2005 13:44:18 +0100"; int mo = 0; while (( mo < 12 ) && ( wcsncmp( date + 8, months[mo], 3 ) != 0 )) mo++; See Alsowcscmp( ), wcscoll( ), strncmp( ), strcmp( ) |