Run Linux commands from Qt4

后端 未结 3 1573
渐次进展
渐次进展 2020-12-16 18:28

How can I run command-line programs under Linux from Qt4? And of course I want to obtain the output in some way I can use. I\'d use it for an ls | grep, but it\

相关标签:
3条回答
  • 2020-12-16 19:03

    What about using popen?

    0 讨论(0)
  • 2020-12-16 19:09

    Use QProcess.

    0 讨论(0)
  • 2020-12-16 19:19
    QProcess p;
    p.start( /* whatever your command is, see the doc for param types */ );
    p.waitForFinished(-1);
    
    QString p_stdout = p.readAllStandardOutput();
    QString p_stderr = p.readAllStandardError();
    
    0 讨论(0)
提交回复
热议问题