I am trying to print an emoji on standard output console in C++ on Mac OS X environment – clang.
This first code works correctly:
#include <iostream>
#include <cwchar>
int main(int argc, const char *argv[]){
char myEmoji[4] = "⛩";
std::cout << "emoji example: " << myEmoji << std::endl;
return 0;
}
and on console I can see:
./emoji ; exit
emoji example: ⛩
logout
When I try this, it works unexpectedly for me:
#include <iostream>
#include <cwchar>
int main(int argc, const char *argv[]){
wchar_t myEmoji = L'⛩';
std::wcout << "emoji example: " << myEmoji << std::endl;
return 0;
}
and this time I get:
./emoji ; exit
emoji example: logout
Where I am wrong?