December 2005
Beginner to intermediate
618 pages
20h 19m
English
wcslen
Obtains the length of a wide-character string
#include <wchar.h> size_twcslen( 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').
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.Read now
Unlock full access