Mbsrtowcs
mbsrtowcs is a C standard-library function that converts a restartable multibyte character string to a wide-character string.
Modern C
mbsrtowcs is a C standard library function that converts a restartable multibyte string to a wide-character string.
- How it is used
- Uses mbsrtowcs to support character counting and wide-string conversion for multibyte strings.
- How deep it goes
- Explains the conversion’s purpose and illustrates length calculation and allocation, without detailing every parameter or error condition.
- Examples
- Shows a length helper using a null destination and a duplication helper allocating and converting a wide string.
- What you can do after
- Apply mbsrtowcs to calculate a wide-character length and convert into an allocated array.
Modern C, Third Edition
mbsrtowcs is a C standard-library function that converts a multibyte string to a wide character string while maintaining conversion state.
- How it is used
- Converts multibyte strings into wide character strings for extended-character processing.
- How deep it goes
- Explains the interface, state handling, length-query idiom, allocation pattern, and invalid-source handling without detailing implementation internals.
- Examples
- Demonstrates zero-length counting through mbsrlen and allocated conversion through mbsrdup.
- What you can do after
- Build converted wide strings and determine their required length while preserving conversion state.
Related concepts
- wide character stringproduces · A wide-character string is a null-terminated array of wchar_t values representing a sequence of wide characters.
- mbrtowcalternative to · mbrtowc is a C standard-library function that converts a multibyte character sequence to a wide character while maintaining restartable conversion state.
Questions about mbsrtowcs
What is mbsrtowcs?
mbsrtowcs is a C standard-library function that converts a restartable multibyte character string to a wide-character string.
Which Manning books explain mbsrtowcs?
Modern C and Modern C, Third Edition.
What should I know before learning mbsrtowcs?
Manning books that teach mbsrtowcs usually introduce wctype.h first.
What is the difference between mbsrtowcs and mbrtowc?
mbsrtowcs is a C standard-library function that converts a restartable multibyte character string to a wide-character string. mbrtowc is a C standard-library function that converts a multibyte character sequence to a wide character while maintaining restartable conversion state.
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.

