如何发送CTRL + Z用C [英] How to send ctrl+z in C
问题描述
我与Arduino的工作。
I'm working with arduino.
我要发 CTRL + Z
C中的字符串我试图截断 ^ Z
但之后没'T的工作。那么怎么办呢?
I want to send ctrl+z
after a string in C. I tried truncating ^Z
but that didn't work. So how to do that ?
推荐答案
控制-Z = 26 = '\\ 032
= '\\ X1A
。无论是反斜线转义序列可以写成一个字符串文本(但如果它后面跟着一个数字或自动对焦或自动对焦,这也将被算作十六进制转义的一部分,这是不是有什么要注意的十六进制转义你想要的)。
Control-Z = 26 = '\032'
= '\x1A'
. Either of the backslash escape sequences can be written in a string literal (but be careful with the hex escape as if it is followed by a digit or A-F or a-f, that will also be counted as part of the hex escape, which is not what you want).
不过,如果你在Windows机器上模拟端子输入(所以你想要的字符作为一个EOF指示来处理),你需要三思。这不是它是如何工作的。
However, if you are simulating terminal input on a Windows machine (so you want the character to be treated as an EOF indication), you need to think again. That isn't how it works.
它可能或你想要什么样的Arduino可能做不到,要么;在某种程度上,这取决于你认为这是要干什么。它也取决于是否如同它从一个终端来输入字符串将被视为
It may or may not do what you want with Arduino, either; in part, it depends on what you think it is going to do. It also depends on whether the input string will be treated as if it came from a terminal.
这篇关于如何发送CTRL + Z用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!