Convert single byte character to wide character
Returns the wide character representation of the byte value c if (and only if) c is a valid multibyte character with a length of a single byte in the initial state of a multibyte sequence.
Otherwise, it returns WEOF.
- The int promotion of a byte (as in a multibyte sequence).
The value is internally converted to an unsigned char to be interpreted.
If c is a valid single-byte character in the initial shift state of a multibyte sequence, the function returns its representation as a wchar_t (type-casted to a value of type wint_t).
If c is EOF, or if c is not a valid single-byte representation, the function returns WEOF.
/* btowc example */
const char mbs  = "btowc example";
for (i=0; i<sizeof(mbs); ++i)
if (btowc(mbs[i]) != WEOF) ++num;
wprintf (L"mbs contains %d single-byte characters.\n",num);
mbs contains 14 single-byte characters.
- Convert wide character to single byte (function
- Convert multibyte sequence to wide character (function
- Convert multibyte string to wide-character string (function