I like how getline(cin, x) works for reading stuff. Unlike cin >> x, it doesn't me开发者_运维知识库ss up the buffer and it seems to allow European characters like á, é, etc too. I was just wondering if there's an output equivalent to this, because cout << x doesn't allow European characters and maybe there's a better option than that.
You can try std::wcout, it is designed to support wide char strings and should work fine with european characters. It has the same usage as std::cout, but you will need the wide string literal prefix 'L':
std::wcout << L"My cool string.";
See Michael Kaplan’s blog for Unicode issues in Windows. For the console, especially the following posts are relevant:
- Myth busting in the console
- Conventional wisdom is retarded
精彩评论