标签:
* Disable line buffer and input echo of stdin
*/
static int __getch()
{
char ch;
struct termios old, new;
(void) tcgetattr(STDIN_FILENO, &old);
memcpy(&new, &old, sizeof(struct termios));
new.c_lflag &= ~(ICANON | ECHO);
(void) tcsetattr(STDIN_FILENO, TCSANOW, &new);
ch = getchar();
(void) tcsetattr(STDIN_FILENO, TCSANOW, &old);
return ch;
}
Disable line buffer and input echo of stdin
标签:
原文地址:http://www.cnblogs.com/banwhui/p/4788312.html