PDA

View Full Version : Indirection operator not working from QProcess



sujan.dasmahapatra
8th June 2010, 12:56
Dear Friends
I am trying to execute an external process for LINUX from within my QT application. Please see below.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
QProcess *process = new QProcess(this);
process->start("qsub runbatch | awk '{print $3}' > processID.dat");
process->waitForStarted(-1);
process->waitForFinished(-1);
process->terminate();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

This should execute
qsub runbatch | awk '{print $3}' > processID.dat
which is a LINUX command the ledt part of >
qsub runbatch | awk '{print $3}'
should return a process ID which is an interger and I want this to be written on a file
processID.dat
which I'll use later.

But I can see this process is not writing any file by name processID.dat
Can anyone help me to resolve this problem , why its not executing a LINUX process

Thanks in advance

squidge
8th June 2010, 13:16
QProcess executes a single process. It does not support shell features such as pipes, redirection, or parameter substitution.

tbscope
8th June 2010, 14:06
However, you can read the output and write it to the file from within your program.