First things first, you're ignoring the return value of _setmode. If it's -1, the call failed, but you'll never know. Second, after reading the documentation on _setmode and associated error links, it appears you cannot use cout with the mode of stdout switched to Unicode. You have to use wprintf instead:
#include
#include
#include
using namespace std;
int main()
{
int r;
r =\_setmode(\_fileno(stdout), \_O\_U16TEXT);
if (r == -1)
perror("Cannot set mode");
wprintf(L"\\u0394\\u03AD\\u03BB\\u03C4\\u03B1\\n");
return 0;
}
CORRECTION: You CAN use COUT, but you must use the wide version of it, but note the L in front of the string being output. It MUST be there:
#include
#include
#include
using namespace std;
int main()
{
int r;
r =\_setmode(\_fileno(stdout), \_O\_U16TEXT);
if (r == -1)
perror("Cannot set mode");
wcout << L"\\u0394\\u03AD\\u03BB\\u03C4\\u03B1" << endl;
return 0;
}
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak