wcslen


wcslen

Obtains the length of a wide-character string

 #include <wchar.h> size_t wcslen ( const wchar_t *s  ); 

The wcslen( ) function calculates the length of the string addressed by its argument s. The length of a wide string is the number of wide characters in it, not counting the terminating null character (L'\0').

Example

 wchar_t line[1024] =                  L"This string could easily be 400 or 500 characters long. "                  L"This string could easily be 400 or 500 characters long. "                  L"\n"; wchar_t *readptr = line; int columns = 80; while ( wcslen( readptr ) > columns )  // While remaining text is too long, {                                      // print a chunk with a final   wprintf( L"%.*ls\\\n", columns-1, readptr );  // backslash and newline.   readptr += columns -1; } wprintf( L"%ls\n", readptr );     // Print the rest, ending with a newline. 

See Also

strlen( ); the example for mbtowc( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net