ILE C/C++ Run-Time Library Functions


wcslen() -- Calculate Length of Wide-Character String

Format

#include <wcstr.h>
size_t wcslen(const wchar_t *string);

Language Level: XPG4

Threadsafe: Yes.

Description

The wcslen() function computes the number of wide characters in the string pointed to by string.

Note:
This function is not available when LOCALETYPE(*CLD) is specified on the compilation command.

Return Value

The wcslen() function returns the number of wide characters in string, excluding the ending wchar_t null character.

Example that uses wcslen()

This example computes the length of the wide-character string string.


#include <stdio.h>
#include <wcstr.h>
 
int main(void)
{
  wchar_t * string = L"abcdef";
 
  printf( "Length of \"%ls\" is %i\n", string, wcslen( string ));
}
 
/****************  Output should be similar to:  ******************
 
Length of "abcdef" is 6
*/

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]