Jump to content
  • Advertisement
Sign in to follow this  
RogerThat123

C++ Console APP special Characters

This topic is 3081 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Which are you having a problem with, having the characters show up in your program or having the characters show up in your IDE?

Share this post


Link to post
Share on other sites
If you're using windows, I think you can do something like:


#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.

Share this post


Link to post
Share on other sites
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
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.

Share this post


Link to post
Share on other sites
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:

WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), L" ╔═══╦═══╦═══╗ ", 16, 0, 0);

to dump a wide character string to the console.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!