I am trying to print emoji on a standard output console in C ++ on Mac OS X - 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 the console I see:
./emoji ; exit
emoji example: ⛩
logout
When I try to do this, it unexpectedly works 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 am I mistaken?
source
share