1 #include <stdio.h>
2 #include <unistd.h>
3 #include <termio.h>
4 #include < string .h>
5
6 void TestIoflag()
7 {
8 struct termio old, new ;
9 char szBuf [ 100 ];
10
11 ioctl(STDIN_FILENO,TCGETA,&old); // Get the current attribute
12
13 new = old; // Backup attribute
14
15 // Enter the character to uppercase and lowercase. For more attributes, see 2
16 new .c_iflag | =IUCLC;
17
18 ioctl(STDIN_FILENO,TCSETA,& new ); // set to the current property
19
20 scanf( " %s " ,szBuf);
21
22 printf( " szBuf:%s\n " ,szBuf);
23
24 ioctl(STDIN_FILENO,TCSETA,&old); // Restore previous properties
25
26 }
27
28 int main()
29 {
30 TestIoflag();
31 return 0 ;
32 }
1. Device file operation process
2. Common property settings