简体   繁体   English

获取发送到 QProcess 的命令的 output

[英]Get output of a command sent to a QProcess

Pretty simple question.很简单的问题。 Let's say I do this:假设我这样做:

m_serverProcess->write("command\n");

How do I get the output of that specific command?如何获取该特定命令的 output?
Is this even possible?这可能吗? I know that I can use readyRead signal, but that is async so the order will probably not be correct.我知道我可以使用 readyRead 信号,但那是异步的,所以顺序可能不正确。

You could try the methods listed in the Qt documentation of QProcess : readAllStandardOutput and readAllStandardError .您可以尝试QProcess 的 Qt 文档中列出的方法: readAllStandardOutputreadAllStandardError You may also use the method exitCode .您也可以使用方法exitCode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM