Voila j'aimerais bien s'avoir comment afficher du texte en couleur avec C sous linux l'équivalent du textcolor; et quelle est la bibliothèque à inclure.Je vous saurais reconnaissant merci d'avance.
Voila j'aimerais bien s'avoir comment afficher du texte en couleur avec C sous linux l'équivalent du textcolor; et quelle est la bibliothèque à inclure.Je vous saurais reconnaissant merci d'avance.
Avec le code ci-dessous, tu en vois de toutes les couleursEnvoyé par monbah
![]()
http://oregnier.developpez.com/cours...hellcolors/#L4
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include <stdio.h> int main() { char Line1[250]; char Line2[250]; int ForeGround; int BackGround; fprintf(stdout," _ _ _ _ _40 _ _ _ 41_ _ _ _42 _ _ _ 43"); fprintf(stdout,"_ _ _ 44_ _ _ _45 _ _ _ 46_ _ _ _47 _\n"); for (ForeGround=30 ; ForeGround <= 37 ; ForeGround++) { sprintf (Line1,"%d ", ForeGround); strcpy(Line2," "); for (BackGround=40 ; BackGround <= 47 ; BackGround++) { sprintf (Line1,"%s\033[%u;%um normal \033[0m",Line1,BackGround,ForeGround); sprintf (Line2,"%s\033[%u;%u;1m bold \033[0m",Line2,BackGround,ForeGround); } printf("%s\n%s\n",Line1,Line2); } }
merci beaucoup pour ton aide.
Partager