📄 conftufr.cc
字号:
/* configuration du terminal en non-bloquant et mode flot (non-canonique). conformite aux normes posix : ici utilisation de tcgetattr() et tcsetattr(). */#include <iostream.h>#include <stdio.h> // pour perror()#include <fcntl.h> /* pour non bloquant */#include <sys/termios.h> /* pour mode non-canonique : "flot" de car. */#include <unistd.h>#include <stdlib.h>//#include <errno.h>int retrd, fini; /* retour de read et fin d'E-S */int fcntl1, fcntl2; /* retours de fcntl()*/int rettc; /* retour tcset et tcget */char c;struct termios etatermi, etatermj; /* etat du terminal - cf stty par exemple */main (){/* on positionne stdin en non bloquant. recuperation de la config courante d'abord. Ensuite passage en non bloquant. */ fcntl1=fcntl(0,F_GETFL); fcntl2=fcntl(0,F_SETFL,O_NONBLOCK);/* on se met en mode canonique et-ou en mode sans echo pour ne pas afficher les cars. tapes : 3 etapes. 1. recuperation 閠at courant*/ rettc=tcgetattr(0,&etatermi); if (rettc != 0){ perror("pb sur tcgetattr"); exit(1); }/* deuxieme 閠ape : on sauvegarde dans etatermj le partie qu'on va modifier, puis modification de l'etat actuel */ etatermj.c_lflag = etatermi.c_lflag; //pour mode non canonique //etatermi.c_lflag &= ~ICANON; //pour masquer la frappe des cars. etatermi.c_lflag &= ~ECHO;/* Grosse difficult
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -