std::mbrtoc16

From Cppreference

Jump to: navigation, search
Defined in header <cuchar>

std::size_t mbrtoc16( char16_t* pc16,

                      const char* s,
                      std::size_t n,

                      std::mbstate_t* ps);
(since C++11)

Converts a narrow multibyte character to a 16-bit wide character.

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 s is a null pointer, the values of n and pc16 are ignored and call is equivalent to std::mbrtoc16(NULL, "", 1, ps).

If the wide character produces is the null character, the shift state *ps is reset to initial shift state.

If the macro __STDC_UTF_16__ is defined, the 16-bit encoding used by this function is UTF-16, otherwise it is implementation-defined.

[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 shift state used when interpreting the multibyte string

[edit] Return value

The first of the following that applies:

[edit] See also

(C++11)
convert a 16-bit wide character to narrow multibyte string
(function)
[virtual]
converts a string from externT to internT, such as when reading from file
(virtual protected member function of std::codecvt<char16_t, char, std::mbstate_t>)