代码:

[plain] view plain copy
  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();  

功能:执行了一个ping命令

结果:

在Qt中调用CMD命令

相关文章:

  • 2021-09-17
  • 2021-09-21
  • 2021-09-21
猜你喜欢
  • 2021-10-03
  • 2021-08-23
  • 2021-11-01
  • 2021-12-20
  • 2021-08-03
  • 2021-10-30
相关资源
相似解决方案