Afficher en C

mignon6800 Messages postés 5 Date d'inscription   Statut Membre Dernière intervention   -  
mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   -
bonjour tout le monde.


void show_box (void)
{


int i, j;

/* *INDENT-OFF* */


char *type1 = "╔ ═ ═ ═ ╤ ═ ═ ═ ╤ ═ ═ ═ ╦ ═ ═ ═ ╤ ═ ═ ═ ╤ ═ ═ ═ ╦ ═ ═ ═ ╤ ═ ═ ═ ╤ ═ ═ ═ ╗\n";


char *type2 = "╟ ─ ─ ─ ┼ ─ ─ ─ ┼ ─ ─ ─ ╫ ─ ─ ─ ┼ ─ ─ ─ ┼ ─ ─ ─ ╫ ─ ─ ─ ┼ ─ ─ ─ ┼ ─ ─ ─ ╢\n";

char *type3 = "╠ ═ ═ ═ ╪ ═ ═ ═ ╪ ═ ═ ═ ╬ ═ ═ ═ ╪ ═ ═ ═ ╪ ═ ═ ═ ╬ ═ ═ ═ ╪ ═ ═ ═ ╪ ═ ═ ═ ╣\n";


char *type4 = "╚ ═ ═ ═ ╧ ═ ═ ═ ╧ ═ ═ ═ ╩ ═ ═ ═ ╧ ═ ═ ═ ╧ ═ ═ ═ ╩ ═ ═ ═ ╧ ═ ═ ═ ╧ ═ ═ ═ ╝\n";


char *thickbar = "║";


char *thinbar = "│";
/* *INDENT-ON* */



printf ("%s", type1);


for (i = 0; i < 9; i++)
{


for (j = 0; j < 9; j++)
{


printf ("%s ", (j % 3) ? thinbar : thickbar);

putchar ((box[i][j]) ? box[i][j] + '0' : ' ');

putchar (' ');

}


printf ("%s\n%s", thickbar,
(i == 8) ? type4 : (i % 3 == 2) ? type3 : type2);


}

}

cette fonction affiche un tableau , le probleme c'est qu'on m'affiche lerreur suivante:

error: stray '\239' in program
error: stray '\187' in program
error: stray '\191' in program

je sais que '\187' est le code ascii de ╗ ainsi de suite mais je ne vois pas le probleme.
ps:c 'est en language C# sous unix

Merci de m'eclaircir...

1 réponse

mamiemando Messages postés 33778 Date d'inscription   Statut Modérateur Dernière intervention   7 884
 
A mon avis il faut simplement utiliser d'autres caractères... Mais pourquoi n'utilises tu pas directement la lib ncurses si tu veux faire une interface en mode texte ?
https://invisible-island.net/ncurses/ncurses-intro.html

Bonne chance
0