| tayyabatiq (3) | |
|
Hi, I want to output chess symbols (http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode) from unicode to console in c++, please tell me how to do that. Im using Dev c++, windows8 and console. Im just a beginner so please keep it simple for me (also tell me the libraries to include please) | |
|
|
|
| Peter87 (3911) | |
On Linux you could just have outputted them in utf8 format std::cout << "♔";Windows doesn't use utf8 so I think your best bet is to use wide characters. Maybe this works: std::wcout = L"♔";EDIT: I don't think Dev C++ has wcout so I really don't know. Hopefully someone else that knows better can come by and help you. | |
|
Last edited on
|
|
| tayyabatiq (3) | |
|
Yes, Dev c++ does not have wcout. And when i try to paste ♔ in the code, it pastes a question mark --> ? instead of the symbol. | |
|
|
|
| Cubbi (1927) | |
Every C++ compiler has std::wcout (in <iostream>)If *pasting* the symbol into the code produces a question mark, your code editor (not the compiler) is probably unable to handle it. How about std::wcout << L'\u2654';?On windows, before you do it, you may have to say these magic words: _setmode(_fileno(stdout), _O_WTEXT); http://msdn.microsoft.com/en-us/library/tw4k6df8(v=vs.110).aspx and make sure your console font supports these characters. On linux, you'd have to set locale: http://ideone.com/WQqyLk | |
|
|
|
| tayyabatiq (3) | |
In Dev C++, using wcout and _setmode(_fileno(stdout), _O_WTEXT); only produces errors saying: "`wcout' undeclared (first use this function) and `_O_WTEXT' undeclared (first use this function)
| |
|
|
|