0

I am a freshman in college taking an Electrical and Computer Engineering course using C code. We are working on the final project (coding a game of Old Maid) right now and I am trying to get these characters printed in the console:

 ██████╗ ██╗     ██████╗         ███╗   ███╗ █████╗ ██╗██████╗ ██╗                      
██╔═══██╗██║     ██╔══██╗        ████╗ ████║██╔══██╗██║██╔══██╗██║                      
██║   ██║██║     ██║  ██║        ██╔████╔██║███████║██║██║  ██║██║                      
██║   ██║██║     ██║  ██║        ██║╚██╔╝██║██╔══██║██║██║  ██║╚═╝                      
╚██████╔╝███████╗██████╔╝        ██║ ╚═╝ ██║██║  ██║██║██████╔╝██╗                      
 ╚═════╝ ╚══════╝╚═════╝         ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝╚═════╝ ╚═╝                      

But what comes out is:

 ??????? ???     ???????         ????   ???? ?????? ?????????? ???
????????????     ????????        ????? ???????????????????????????
???   ??????     ???  ???        ?????????????????????????  ??????
???   ??????     ???  ???        ?????????????????????????  ??????
?????????????????????????        ??? ??? ??????  ?????????????????
 ??????? ???????????????         ???     ??????  ????????????? ???

I even tried saving the .c file differently as well as reading the characters in from a text file as an array and printing that, but the same problems occurs. Are these characters just impossible to use? I am working on Visual Studios 2015. Any help would be appreciated, I'm still kinda new to this stuff.

PFis
  • 3
  • 1
  • 1
    What is your console (console emulator) and what is [the codepage](https://en.wikipedia.org/wiki/Code_page) used by it? You should know which codepage is active (or how to change it to the needed one, probably some from old DOS times for [╔ and ╝ symbols](https://en.wikipedia.org/wiki/Box-drawing_character) like [437 code page](https://en.wikipedia.org/wiki/Code_page_437); or try to unicode?) and find codes of symbols used for formatting. – osgx Apr 14 '17 at 02:08
  • 1
    Possible duplicate of [Unicode characters in Windows command line - how?](http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how) – Alexander O'Mara Apr 14 '17 at 02:10

1 Answers1

0

You should consider the use of wide characters.
See the C standard library wchar.h.

For example:

#include <stdio.h>
#include <wchar.h>
#include <stdlib.h>

int main(int argc, char** argv) {
  wchar_t widechar = L'\x220E';

  wprintf(L"%lc\n", widechar);

  return EXIT_SUCESS;
}

The output:

Remy J
  • 709
  • 1
  • 7
  • 18