博客
关于我
Troubleshoot Qt 执行CMD命令并获取输出 <windows>
阅读量:121 次
发布时间:2019-02-26

本文共 556 字,大约阅读时间需要 1 分钟。

Troubleshoot Qt 执行CMD命令并获取输出

二、使用步骤

1.QProcess执行CMD 命令

代码如下(示例):

QProcess pro(this);pro.start("cmd", QStringList()<<"/c"<<"ping www.baidu.com");//

QProcess接口:

在这里插入图片描述“/c”:执行完命令后关闭命令窗口
<1>添加“/c”:
在这里插入图片描述<2>不加"/c":
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210402162840122.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ppYW5nMTczNzA3,size_16,color_FFFFFF,t_70#pic_center

2.获取输出

代码如下(示例):

pro.waitForStarted(); pro.waitForFinished(); QString strTemp=QString::fromLocal8Bit(pro.readAllStandardOutput());

QProcess接口:

在这里插入图片描述

转载地址:http://xjpf.baihongyu.com/

你可能感兴趣的文章
Netty:原理架构解析
查看>>
Network Dissection:Quantifying Interpretability of Deep Visual Representations(深层视觉表征的量化解释)
查看>>
Network Sniffer and Connection Analyzer
查看>>
Network 灰鸽宝典【目录】
查看>>
Network-Emulator Network-Emulator-Toolkit网络模拟器使用
查看>>
Networkx写入Shape文件
查看>>
NetworkX系列教程(11)-graph和其他数据格式转换
查看>>
Networkx读取军械调查-ITN综合传输网络?/读取GML文件
查看>>
NetworkX:是否为每个节点添加超链接?
查看>>
network小学习
查看>>
Netwox网络工具使用详解
查看>>
Net与Flex入门
查看>>
Net任意String格式转换为DateTime类型
查看>>
net包之IPConn
查看>>
net发布的dll方法和类显示注释信息(字段说明信息)[图解]
查看>>
Net和T-sql中的日期函数操作
查看>>
Net处理html页面元素工具类(HtmlAgilityPack.dll)的使用
查看>>
Net操作Excel(终极方法NPOI)
查看>>
Net操作配置文件(Web.config|App.config)通用类
查看>>
net网络查看其参数state_dict,data,named_parameters
查看>>