Afficher en C
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...
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...
A voir également:
- Afficher en C
- Afficher appdata - Guide
- Afficher google en page d'accueil - Guide
- Afficher taille dossier windows - Guide
- Windows 11 afficher d'autres options - Guide
- Afficher mot de passe wifi android - Guide
1 réponse
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
https://invisible-island.net/ncurses/ncurses-intro.html
Bonne chance