echostate.c
来自「unix linux 编程实践源代码」· C语言 代码 · 共 25 行
C
25 行
/* echostate.c * reports current state of echo bit in tty driver for fd 0 * shows how to read attributes from driver and test a bit */#include <stdio.h>#include <termios.h>main(){ struct termios info; int rv; rv = tcgetattr( 0, &info ); /* read values from driver */ if ( rv == -1 ){ perror( "tcgetattr"); exit(1); } if ( info.c_lflag & ECHO ) printf(" echo is on , since its bit is 1\n"); else printf(" echo if OFF, since its bit is 0\n");}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?