更新时间:2022-12-01 07:49:28
您可以使用 QProcess .
#include <QDebug>
#include <QProcess>
#include <QString>
int main()
{
QProcess echo;
// call your program (e.g. echo) and add your input as argument
echo.start("echo", QStringList() << "foo bar");
// wait until your program has finished
if (!echo.waitForFinished())
return 1;
// read the output
qDebug() << echo.readAll();
return 0;
}