C++ Console APP special Characters
I want to be able to use special characters in my console application because Im making a tic tac toe game,
I need to see these chars - " ╔═══╦═══╦═══╗ ".
I tried changing my IDE font to terminal like the console output font but it still didnt work.
All that shows are question marks "????????????"
Any ideas?
Which are you having a problem with, having the characters show up in your program or having the characters show up in your IDE?
If you're using windows, I think you can do something like:
Google ASCII Chart or ASCII table and you should be able to come up with a list of the ASCII character codes and the character they produce.
#include <iostream>int main(){ std::cout << char(x); //Where x is the ASCII code of the character you want} //end f()
Google ASCII Chart or ASCII table and you should be able to come up with a list of the ASCII character codes and the character they produce.
The IDE is displaying the Unicode characters, while your console is (most likely) displaying the IBM extended ascii charset. I.e. in Unicode, ╔ is L'\x2554' whereas in a console, ╔ is '\x69'
To be able to display those special characters you have to type cast ints. You could make consts for each character you want displayed and then with a cout
I know a few IDEs that don't display the characters but the console does. And only Windows I believe, since those characters you showed are windows special characters.
This will help. It is a list of all the numbers and their corresponding character.
This is a program I made that actually uses those characters. Doing the char(int) approach was the only way I could find to get those displayed, even copying and pasting wasn't working.
cout << char(someInt);
I know a few IDEs that don't display the characters but the console does. And only Windows I believe, since those characters you showed are windows special characters.
This will help. It is a list of all the numbers and their corresponding character.
This is a program I made that actually uses those characters. Doing the char(int) approach was the only way I could find to get those displayed, even copying and pasting wasn't working.
I have to print tons of theses characters, if possible Id like to put them into one block " " and somehow print them..
Depending on your operating system, you may be able to use system calls to display arbitrary unicode characters. For example, on Windows you should be able to do something like:
to dump a wide character string to the console.
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), L" ╔═══╦═══╦═══╗ ", 16, 0, 0);
to dump a wide character string to the console.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement