16,215
社区成员
发帖
与我相关
我的任务
分享
这句话QString filepath=QCoreApplication::applicationDirPath();它直接获取的是执行程序目录,还是外部程序的目录啊 调用QProcess::startDetached(str_exe_path);之前使用:QProcess::setWorkingDirectory(filepath)试试
调用QProcess::startDetached(str_exe_path);之前使用:QProcess::setWorkingDirectory(filepath)试试
QString filepath=QCoreApplication::applicationDirPath(); QDir dir(filepath);dir.cdUp(); filepath=dir.absolutePath(); QString file_path=filepath+"/tape5"; if(!file.open(QIODevice::WriteOnly|QIODevice::Text)) {std::cerr<<"warning!"; return; } QTextStream out(&file); . . . .这是输入的内容 . . QString str_exe_path=filepath+"/mod371.exe"; qDebug()<<str_exe_path; QProcess::startDetached(str_exe_path); 我想问下我这段代码有什么问题,为什么外部程序执行不了。
调用QProcess::startDetached(str_exe_path);之前使用:QProcess::setWorkingDirectory(filepath)试试