A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../ranges/../string/multibyte/mbrtoc16.html below:

std::mbrtoc16 - cppreference.com

Converts a narrow multibyte character to UTF-16 character representation.

If s is not a null pointer, inspects at most n bytes of the multibyte character string, beginning with the byte pointed to by s to determine the number of bytes necessary to complete the next multibyte character (including any shift sequences). If the function determines that the next multibyte character in s is complete and valid, converts it to the corresponding 16-bit character and stores it in *pc16 (if pc16 is not null).

If the multibyte character in *s corresponds to a multi-char16_t sequence (e.g., a surrogate pair in UTF-16), then after the first call to this function, *ps is updated in such a way that the next call to mbrtoc16 will write out the additional char16_t, without considering *s.

If s is a null pointer, the values of n and pc16 are ignored and the call is equivalent to std::mbrtoc16(nullptr, "", 1, ps).

If the wide character produced is the null character, the conversion state *ps represents the initial shift state.

The multibyte encoding used by this function is specified by the currently active C locale.

[edit] Parameters pc16 - pointer to the location where the resulting 16-bit character will be written s - pointer to the multibyte character string used as input n - limit on the number of bytes in s that can be examined ps - pointer to the conversion state object used when interpreting the multibyte string [edit] Return value

The first of the following that applies:

[edit] Example

Output:

Processing 10 bytes: [7A C3 9F E6 B0 B4 F0 9F 8D 8C]
Next UTF-16 char: 007A obtained from 1 bytes [7A]
Next UTF-16 char: 00DF obtained from 2 bytes [C3 9F]
Next UTF-16 char: 6C34 obtained from 3 bytes [E6 B0 B4]
Next UTF-16 char: D83C obtained from 4 bytes [F0 9F 8D 8C]
Next UTF-16 char: DF4C obtained from earlier surrogate pair
[edit] See also converts a UTF-16 character to narrow multibyte encoding
(function) [edit] converts a narrow multibyte character to UTF-8 encoding
(function) [edit] converts a string from ExternT to InternT, such as when reading from file
(virtual protected member function of std::codecvt<InternT,ExternT,StateT>) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4