摘要: #include int getch(void){ struct termios tm, tm_old; int fd = 0, ch; if (tcgetattr(fd, &tm) < 0) {//保存现在的终端设置 return -1; } ... 阅读全文
posted @ 2014-06-13 11:38 老高是我 阅读(782) 评论(0) 推荐(0)
摘要: 转载自这里清空键盘缓冲区很多种方法,如用fflush(stdin);rewind(stdin);等,但是在linux这些都不起作用,还得我今天试了半天都没成功,上网搜了一下发现setbuf(stdin, NULL);就能直接清空键盘缓冲区了。以下几个实例:Sample one123456789101... 阅读全文
posted @ 2014-06-13 09:25 老高是我 阅读(1632) 评论(0) 推荐(2)