1 QProcess p(0); 2 p.start("cmd", QStringList()<<"/c"<<"ping www.baidu.com"); 3 p.waitForStarted(); 4 p.waitForFinished(); 5 QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput()); 6 7 QMessageBox testMassage; 8 testMassage.setText(strTemp); 9 testMassage.exec();