Unicode debug output works in VS 2015 intermediate window.

I updated the comments in the demo app about this.
This commit is contained in:
Mike Lischke 2016-12-13 13:52:30 +01:00
parent f003cce7d9
commit 8bb522dd4e
1 changed files with 3 additions and 7 deletions

View File

@ -30,16 +30,12 @@ int main(int argc, const char * argv[]) {
CommonTokenStream tokens(&lexer);
TParser parser(&tokens);
tree::ParseTree* tree = parser.main();
tree::ParseTree *tree = parser.main();
std::wstring s = antlrcpp::s2ws(tree->toStringTree(&parser)) + L"\n";
// Unfortunately, there is no way of showing the Unicode output properly in either the Intermediate Window in VS
// (when using OutputDebugString), nor in a terminal (when using wcout). Instead set a breakpoint and view the
// content of s in the debugger, which works fine.
OutputDebugString(s.data());
std::wcout << "Parse Tree: " << s << std::endl;
OutputDebugString(s.data()); // Only works properly since VS 2015.
//std::wcout << "Parse Tree: " << s << std::endl; Unicode output in the console is very limited.
return 0;
}