gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 10:46:32 26 4
gpt4 key购买 nike

通过引用以下链接中的来源: 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). Moreprecisely: this character causes the pending tty buffer to besent 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com