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'). Examplewchar_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 Alsostrlen( ); the example for mbtowc( ) |