std::btowc
From cppreference.com
Defined in header <cwchar>
|
||
std::wint_t btowc( int c ); |
||
Widens a single-byte character c to its wide character equivalent.
Most multibyte character encodings use single-byte codes to represent the characters from the ASCII character set. This function may be used to convert such characters to wchar_t.
Contents |
[edit] Parameters
c | - | single-byte character to widen |
[edit] Return value
WEOF if c is EOF.
Wide character representation of c if (unsigned char)c is a valid single-byte character in the initial shift state, WEOF otherwise.
[edit] Example
Run this code
#include <clocale> #include <cwchar> #include <iostream> void try_widen(char c) { std::wint_t w = std::btowc(c); if (w != WEOF) std::cout << "The single-byte character " << +(unsigned char)c << " widens to " << +w << '\n'; else std::cout << "The single-byte character " << +(unsigned char)c << " failed to widen\n"; } int main() { std::setlocale(LC_ALL, "lt_LT.iso88594"); std::cout << std::hex <<