skyilyskyily.blog.chinaunix.net
skyily
全部博文(144)
2010年(16)
2009年(128)
Zane_Yu
tasteswe
zwrvvv
xiao888l
zimuqing
leilelei
Phyllis6
jonathan
denghai1
wbdwbd04
itTangze
lifj1234
18141908
AAABug
分类: LINUX
2009-04-11 09:45:28
keypress.h文件
#ifndef _INCLUDE_KEYPRESS_H_#define _INCLUDE_KEYPRESS_H_#include <termios.h>void set_keypress(void);void reset_keypress(void);#endif
keypress.c文件
#include <termios.h>//===========================================================//终端属性设置uart//===========================================================static struct termios old_settings;void set_keypress(void) //设置{ struct termios new_settings; tcgetattr(0, &old_settings); new_settings = old_settings;
/* Disable canonical mode, and set buffer size to 1 byte */ new_settings.c_lflag &= (~ICANON); new_settings.c_lflag &= (~ECHO); new_settings.c_cc[VTIME] = 0; new_settings.c_cc[VMIN] = 1; tcsetattr(0, TCSANOW, &new_settings); return;}void reset_keypress(void)//恢复{ tcsetattr(0, TCSANOW, &old_settings); return;}
上一篇:c中经典的选择排序
下一篇:管道pipe和dup2的简单使用
登录 注册