代码:

[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-07-14
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-27
  • 2022-01-11
  • 2021-12-06
  • 2022-02-15
  • 2021-12-06
  • 2021-12-06
  • 2021-11-27
相关资源
相似解决方案