yartempion | Voici un bout de code,
Code :
- #include<stdio.h>
- #include<termios.h>
- #include<unistd.h>
- main()
- {
- unsigned char c[5];
- int nb_lu,nb_ec,compt=0;
- struct termios term_d,term_m;
- tcgetattr(STDIN_FILENO,term_d);
- tcgetattr(STDIN_FILENO,term_m);
- term_m.c_lflag &=~ICANON;
- term_m.c_cc[VTIME]=0;
- term_m.c_cc[VMIN]=1;
- tcsetattr(STDIN_FILENO,TCSANOW,term_m);
- printf("\nLe clavier est passe en mode icannon" );
- printf("\nlecture direct" );
- nb_lu=read(0,c,5);
- while(compt<nb_lu)
- {
- printf("\nonentre dans le while" );
- printf("\nnb_ec=%d nb_lu=%d carac =%02X\n",compt,nb_lu,c[compt]);
- compt=compt+1;
- sleep(2);
- }
- tcsetattr(STDIN_FILENO,TCSANOW,term_d);
- printf("\nfin de prog\n" );
- sleep(5);
- }
|
Je lance le code je ne comprends pas pourquoi la fenetre se ferme a la fin du prog. |