c - Linux串口编程c_cc字符配置

标签 c linux serial-port

通过引用以下链接中的来源: 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/

相关文章:

linux - 同时执行 awk 和 sed 命令

javascript - 如何修复 'Cannot read property ' includes' of undefined' in nodejs? [脚本]

c++ - 使用挂起的 read_async_some 关闭 boost::asio::serial_port

java - 只是试图将数据从 Java Applet 写入串行端口?

Linux,串口,非缓冲模式

const char** 与 const char* 突变

c - 读取C中的汇编文件

C printf char以连续方式打印大于等于8个字符

c - 具有多个成员的结构数组

c - 如何与 fork 的后台进程进行通信/接口(interface)?