How can I direct the output of a QProcess to a file?

北慕城南 提交于 2019-12-07 02:10:10

问题


I want to have the output of qconf redirected to test_settings.txt in my tmp folder. I've thought of two possibilities:

QProcess procWriteProject;

procWriteProject.start("qconf", QStringList() << " -sprj "
    << projectList[0] << " >> " << "\"/tmp/testing.txt\"");

procWriteProject.start("qconf -sprj " + projectList[0] + " >> "
    + "/tmp/test_settings");

Will either of those work? Is there a better way?


回答1:


QProcess procWriteProject;
procWriteProject.setStandardOutputFile("/tmp/test_settings.txt");
procWriteProject.start("qconf", QStringList() << "-sprj" << projectList[0]);


来源:https://stackoverflow.com/questions/1805119/how-can-i-direct-the-output-of-a-qprocess-to-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!