QProcess::start(i) - i is a file with spaces
Solved
General and Desktop
-
Hello all,
I am trying to pass a .exe file containing spaces such as te st2.exe to QProcess::start().
However, the process doesn't actually open the file even though if the .exe file is without spaces such as test3.exe, it runs perfectly.Example code:
QDir directory = QDir::currentPath(); QStringList list = directory.entryList(QStringList() << "*.exe" << "*.EXE", QDir::Files); /* list contains: ("te st2.exe", "test3.exe") */ for(auto& i : list){ QProcess p; p.start(i); p.waitForFinished(); QString output = p.readAllStandardOutput(); }
Now, my question is how to run a file having a name which contains spaces?
All ideas are appreciated! Thanks!