📄 p9-10.c
字号:
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <termios.h>#include <errno.h>int main(void){ int tcflush_value; int stat_loc; int fildes ; char buf[] = "hello world\n"; int i,a[1024]; fildes = fileno(stdout); fprintf (stdout,"Example of line control functions\n"); fprintf (stdout,"write string to stdout\n"); write(fildes, buf, sizeof(buf)); fprintf (stdout,"suspend transmission or reception of data\n"); tcdrain (fildes); /* 等待输出队列中的数据全部送出 */ tcflow(fildes, TCOOFF); /* 暂停输出 */ for(i = 0; i < 1024; i++) a[i] = 101; write(fildes, a, 1024); fprintf (stdout,"flush the stdin and discard the output\n"); tcflush_value = tcflush(fildes, TCIOFLUSH); /* 清除输入输出队列 */ if (tcflush_value < 0) fprintf (stderr,"ERROR: tcflush() call failed\n"); fprintf (stdout,"tcflush() call successful\n"); fprintf (stdout,"no output yet\n"); fprintf (stdout,"restart the output\n"); tcflow (fildes, TCOON); /* 恢复输出 */ exit (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -