问题描述
我在 Ubuntu 16.04 下使用 Qt 5.5.1,但在不同环境下情况相同。如果输出速度足够高(~10 kb / 秒),我将无法获得完整的进程输出。
QObject::connect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(readOutput()));
...
process.start("./program",paramsList,QProcess::Unbuffered | QProcess::ReadWrite);
process.waitForStarted();
...
void Window::readOutput() {
QByteArray output = process.readAllStandardOutput(); // Here in debugger (and in gui
// output) I receive only parts of output like "ple = 0x000","ample = ","= 0x",// many strings are skipped,// instead of "Sample = 0x00000001","Sample = 0x00000002","Sample = 0x00000003"
}
“./program”的控制台输出是正确的。 我曾尝试使用 QProcess::Unbuffered 等 QProcess 参数,但结果是一样的。
那么问题是:是否可以使用此类从进程中获取ALL 输出,而不会跳过任何数据?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)