How to use wcout (standard output stream for wide characters) in C++

2 Answers

0 votes
#include <iostream>

int main() {
    std::wcout << (wchar_t)0x41;

    return 0;
}



/*
run:

A

*/

 



answered Jan 4, 2021 by avibootz
0 votes
#include <iostream>
#include <string>
#include <locale>

int main() {

    std::locale::global(std::locale(""));
    std::wstring japanese = L"日本";
    
    std::wcout << japanese;
    
    return 0;
}



/*
run:

日本

*/

 



answered Jan 5, 2021 by avibootz

Related questions

1 answer 269 views
1 answer 158 views
1 answer 151 views
1 answer 201 views
201 views asked Nov 12, 2016 by avibootz
1 answer 224 views
...