Name

wcsnlen - determine the length of a fixed-size wide-character string

Library

libc.lib

Synopsis

  #include <wchar.h>
  size_t wcsnlen (const wchar_t *wcs, size_t maxlen);

Detailed description

The wcsnlen() function computes the length of the wide-character string wcs not including the terminating NUL character. It looks at only first maxlen
wide-characters in wcs and never beyond wcs+maxlen.

Examples

#include <wchar.h>
/* Illustrates how to use wcsnlen API */
size_t example_wcsnlen()
{ 
  /* input string for which length to be found */
 wchar_t *ws=L"testwcsnlen";
    
  /* find the length of the wide char string by */
  /* calling wcsnlen */
  size_t retval = wcsnlen(ws,14);
 /* return the number of wide chars in the string */
 /* if retval is less than 14 Else return 14 as the */
 /* length of the string */
 return retval;
}

         


Return value

The wcsnlen() returns the number of wide-characters that precede the terminating NUL character if it is less than maxlen or maxlen if there is a terminating NUL character among maxlen characters pointed by wcs.

See also

strnlen

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top