通过引用以下链接中的来源: Serial_Port_Programming_How_To
我发现那里有c_cc字符配置。 在搜索了 affections 之后,我没有找到确切的答案。 我尝试注释掉这些 c_cc 配置的每一行,发现以下行确实影响了输出。
newtio.c_cc[VEOF] = 4;
任何人都可以解释这个的含义以及其他可能的含义吗?
谢谢
最佳答案
按照建议,termios 的手册页是一个起点:
VEOF
(004, EOT, Ctrl-D) End-of-file character (EOF). More precisely: this character causes the pending tty buffer to be sent to the waiting user program without waiting for end-of-line. If it is the first character of the line, the read(2) in the user program returns 0, which signifies end-of-file. Recognized when ICANON is set, and then not passed as input.
在给定链接的上下文中,3.1. Canonical Input Processing , OP 观察到注释掉一个作业
newtio.c_cc[VEOF] = 4;
阻止 ^D
按预期工作。那和类似的分配对应于可能用于带有 stty
的 shell 脚本的设置。 .在内部(使用 termios),当分配 0xff
时,这些设置为 undefined 值,但默认 0x00
几乎一样好。
关于c - Linux串口编程c_cc字符配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32859827/