few days ago i asked about how to get all running processes in the system using QProcess. i found a command line that can output all processes to a file:
C:\WINDOWS\system32\wbem\wmic.exe" /OUTPUT:C:\ProcessList.txt PROCESS get Caption
this will create C:\ProcessList.txt file contains all running processes in the system. i wonder how can i run it using QProcess and take its output to a variable.
it seems every time i try to run it and read nothing happens:
QString program = "C:\\WINDOWS\\system32\\wbem\\wmic.exe";
QStringList arguments;
arguments << "/OUTPUT:C:\\ProcessList.txt" <<"PROCESS"<< "get"<< "Caption";
process->setStandardOutputFile("process.txt");
process->start(program,arguments);
QByteArray result = process->readAll();
i prefer not to create process.txt at all and to take all the output to a variable...