標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C 改訂 |
両方 |
#include <wchar.h> /* or #include <wcstr.h> */
size_t wcslen(const wchar_t *string);
string が指すストリング内のワイド文字数を 計算します。
このワイド文字関数の動作は、現行ロケールの LC_CTYPE カテゴリーの影響を受けます。 カテゴリーを変更すると、未定義の結果が発生する可能性があります。
wcslen() は、終了ワイド NULL 文字の前にあるワイド文字の数を戻します。
⁄* CELEBW12
This example computes the length of a wide-character string,
using &wcslen.
*⁄
#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t * string = L"abcdef";
printf( "Length of ¥"%ls¥" is %i¥n", string, wcslen( string ));
}
Length of "abcdef" is 6