代码:
QProcess p(0);
p.start("cmd", QStringList()<<"/c"<<"ping www.baidu.com");
p.waitForStarted();
p.waitForFinished();
QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput());
QMessageBox testMassage;
testMassage.setText(strTemp);
testMassage.exec();
功能:执行了一个ping命令
结果: