標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C 改訂 |
両方 |
#include <wchar.h>
int wcscmp(const wchar_t *string1, const wchar_t *string2);
2 つのワイド文字ストリングを比較します。wcscmp() 関数は、NULL 文字で終了するワイド文字ストリングを操作します。この関数に対するストリング引数には、ストリングの終わりにマークを 付けるワイド NULL 文字が入っていなければなりません。
このワイド文字関数の動作は、現行ロケールの LC_CTYPE カテゴリーの影響を受けます。 カテゴリーを変更すると、未定義の結果が発生する可能性があります。
⁄* CELEBW06
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 ( 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);
}
"abcdef" is less than "abcdefg"