text: The mbrtoc16() function is defined in <cuchar> header file.
  size_t mbrtoc16( char16_t* pc16, const char* s, size_t n, mbstate_t* ps);
  The mbrtoc16() function converts at most n multibyte character represented by s to its equivalent utf-16 character and stores it in the memory location pointed to by pc16.
  If s represents a null pointer, the values of n and pc16 are ignored and the call to is equivalent to mbrtoc16(NULL, "", 1, ps).
  If the resulting character produced is null, the conversion state *ps represents the initial shift state.
  The mbrtoc16() function returns the first of the following value that matches the cases below:
  char16_tfrom a multi-char16_t character (e.g. a surrogate pair) has now been written to *pc16. No bytes are processed from the input in this case.
  #include <cstdio> #include <cstdlib> #include <cuchar> #include <iostream> using namespace std; int main(void) { char16_t pc16; char s[] = "x" ; mbstate_t ps{}; int length; length = mbrtoc16(&pc16, s, MB_CUR_MAX, &ps); if (length < 0) { perror("mbrtoc16() fails to convert"); exit(-1); } cout << "Multibyte string = " << s << endl; cout << "Length = " << length << endl; printf ("16-bit character = 0x%04hx\n", pc16); return 0; }
  When you run the program, the output will be:
  Multibyte string = x Lengt>h = 1 16-bit character = 0x0078