#include
#include
#include
#include
int main(int argc,char* argv[])
{
char buf[10];
char lu;
struct termios tt_avant, tt_apres;
//recuperation d errread(0,buf,10);eurs et recuperation du bloc de controle standard dans tt_avant
if(tcgetattr(0, &tt_avant)==-1)
{perror("tcgetattr"); exit(1);}
tt_apres=tt_avant;
tt_apres.c_iflag &= ~(IXON|IXOFF);
tt_apres.c_lflag &= ~(ICANON|ECHO);
tt_apres.c_cc[VMIN]=1;
//int tcsetattr(int fd, int optional_actions, struct termios *termios_p);
if(tcsetattr(0,TCSANOW, &tt_apres)==-1)
{perror("tcsetattr"); exit(1);}
do
{
read(0,buf,10);
lu=buf;
printf("%d caractere lu= %c\n",strlen(buf),lu);
fflush(&buf);
}
while (lu!='F');
if(tcsetattr(0,TCSANOW, &tt_avant)==-1)
{perror("tcsetattr"); exit(1);}
return 0;
}
Comments: 0