wcslen() - ワイド文字ストリング長の計算

標準

標準/拡張機能 C/C++ 依存項目

ISO C 改訂
XPG4
XPG4.2
C99
Single UNIX Specification、バージョン 3

両方  

形式

#include <wchar.h> /*  or #include <wcstr.h>  */

size_t wcslen(const wchar_t *string);

機能説明

string が指すストリング内のワイド文字数を 計算します。

このワイド文字関数の動作は、現行ロケールの LC_CTYPE カテゴリーの影響を受けます。 カテゴリーを変更すると、未定義の結果が発生する可能性があります。

戻り値

wcslen() は、終了ワイド NULL 文字の前にあるワイド文字の数を戻します。

CELEBW12
⁄* 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

関連情報