How to add in a program that runs at the command prompt in C

Asked

Viewed 82 times

1

I’m doing my first C programming project, and it’s a card game. The problem is that I do not know how to add the symbol of suits to run at the prompt. They are not in the ascii table, but I know it has how to do. Can you give me a north? Thank you

  • 1

    This problem is not with C probably, but with the terminal that will run, it probably depends on the configuration of its interface, you can even use the command system(), but in windows will be one thing and in other terminal emulators will be another command within system(), will depend on the operating system that runs.

  • Something like this, https://ideone.com/wmjMdj?

  • It is only for windows the program. How can I make these suits appear at windows prompt?

  • Dear user, as I said, you can even get by using some command system(), but it is more likely that it will only be possible to configure on the CMD interface itself, right-clicking on the window title and then properties, of course I think you can do via system, but I’m inclined to believe that some things in XP, 7, 8 and 10 can vary.

1 answer

0

In my environment (Ubuntu) ran normally:

#include <stdio.h>
int main() {
    printf("Naipes: ♠ ♣ ♥ ♦ ♡ ♢ ♤ ♧ \n");   
    return 0;
}

:~/Testes/C$ gcc -o naipes naipes.c
:~/Testes/C$ ./naipes
Naipes: ♠ ♣ ♥ ♦ ♡ ♢ ♤ ♧ 

Here too: https://ideone.com/Aoq6Xv

  • So, windows does not run. this is the result:Suits: ât ât£ ât ât ât¡ât ât ât§

  • https://stackoverflow.com/questions/53220783/what-locale-lc-ctype-is-used-for-windows-unicode-console-app

  • 1

    Dear Anonimo, in my Ubuntu does not run, you have to configure the terminal, so the soução would be like configure the terminal or configure the CMD (in Windows). I don’t really know if wprintf+_setmode will solve, because it probably implies "dependencies" ranging from system to system.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.