我正在使用 Qt。
谁能告诉我如何在 QProcess
中使用字符串?
更清楚地说,我正在制作一个图像转换器,我在其中使用 QFileDialog
将 png 文件的目标文件路径转换为字符串。
现在我有一个 exe 文件,它可以完成 png 到 jpeg 的所有转换,我需要做这样的事情:
convertor.exe path/to/png/file path/for/storing/converted/output
我如何在 Qt 中做到这一点?
QProcess conv;
conv.start("C:/converter.exe" ??) what to do here?
最佳答案
您可以将参数作为 QStringList 提供给进程:
QStringList args;
args << "path/to/png/file" << "path/for/storing/converted/output";
QProcess conv;
conv.start("C:/converter.exe", args);
关于c++ - 将 QProcess 与包含执行文件路径的字符串一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11764553/