Linux的输入和删除的
来源:互联网 发布:全自动洗衣机plc编程 编辑:程序博客网 时间:2024/05/16 05:24
一,tcgetattr和tcsetattr的使用方法
#include <termios.h> #include <unistd.h> int tcgetattr(int fd, struct termios *termios_p); int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); int tcsendbreak(int fd, int duration); int tcdrain(int fd); int tcflush(int fd, int queue_selector); int tcflow(int fd, int action); void cfmakeraw(struct termios *termios_p); speed_t cfgetispeed(const struct termios *termios_p);
代码
#include <stdio.h> 2 #include <stdlib.h> 3 #include <unistd.h> 4 #include <string.h> 5 #include <termios.h> 6 #include <errno.h> 7 8 9 int main(void) 10 { 11 12 13 struct termios term; 14 15 if ( tcgetattr(STDIN_FILENO, &term) == -1 ) //通过 16 { 17 printf("tcgetattr error is \n"/*, strerror(errno)*/); 18 return -1; 19 } 20 21 term.c_cc[VERASE] = '\b'; //这个代表前面字符的功能 22 //term.c_cc[VINTR]; //这个代表进程送一个SIGINT信号键 23 24 if ( tcsetattr(STDIN_FILENO, TCSANOW, &term) == -1) { 26 printf("tcsetattr error is %s\r\n", strerror(errno)); 27 return -1; 28 } 29 30 31 char buf[1024]; 32 memset(buf, 0, sizeof(buf)); 33 34 read(STDIN_FILENO, buf, sizeof(buf)); 35 36 return 0; 37 }
阅读全文
0 0
- Linux的输入和删除的
- linux 删除已输入的命令
- linux 删除已输入的命令
- Linux 快速删除已输入的命令
- android 多个edittext的输入和删除
- 输入/输出流 和 文件的创建与删除
- Dom-删除表格的行和列,指定输入
- android文件的创建,删除和输入,输出操作
- 关于动态的新增输入框和删除
- angular 的表格输入添加和批量删除
- linux 下的标准输入和输出
- linux中模块的增添和删除
- Linux 常用命令 目录的创建和删除
- Linux共享内存的查看和删除
- Linux共享内存的查看和删除
- linux启动服务的添加和删除
- Linux共享内存的查看和删除
- linux 删除和移动的常用快捷键
- 我的博客今天0岁250天了,我领取了…
- MAC Flapping , MAC的漂移
- LAC LNS
- ICMP/ICMP报文分析
- V.24;V.35;ISDN;E1…
- Linux的输入和删除的
- VDSL与ADSL的区别
- CIDR
- MDI和MDI_X
- 以太网协议封装格式
- 思科交换机的SMI和EMI是什么意思
- VLAN
- 华为VLAN中的GARP和GVRP
- 通道化模块与非通道化的差别在哪?