I want to use QProcess
to run a Linux command in my Qt project. My process has some arguments so I used the following code:
QString _strFileName = "/root/a.o";
QStringList _strListArguments;
_strListArguments << "-c" << "file " << _strFileName << " | grep ELF";
_processFile->start("bash", _strListArguments);
_processFile->waitForFinished();
The output is null. But when I replace the variable with a value, the output is OK and there is no error there.
_strListArguments << "-c" << "file /root/a.o | grep ELF";
How can I solve this?