liveBook · Manning

Wide character string

A wide-character string is a null-terminated array of wchar_t values representing a sequence of wide characters.

How 2 Manning books explain it

Modern C

A wide character string is a null-terminated array of wchar_t elements representing a sequence of wide characters.

How it is used
Provides a destination for converting multibyte strings into sequences of wide characters.
How deep it goes
Works through length calculation and allocation for conversion, without developing a general wide-string interface.
Examples
Uses a conversion function that allocates mblen + 1 wchar_t elements and calls mbsrtowcs.
What you can do after
Build it from scratch by counting multibyte characters, allocating space for a terminator, and converting with mbsrtowcs.

Read how Modern C explains wide character string →

Modern C, Third Edition

A wide character string is a null-terminated array of wchar_t values representing characters from an extended character set.

How it is used
Handles extended-character strings when ordinary byte-string operations are insufficient.
How deep it goes
Defines representation and conversion, then addresses string functions, invalid input, and wchar_t portability without fully specifying encodings.
Examples
Uses mbsrdup to allocate and populate a wide string after measuring a multibyte source.
What you can do after
Apply it via C library functions to convert multibyte strings and perform wide-character string operations.

Read how Modern C, Third Edition explains wide character string →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.