A Common Man in India

A common man in an uncommon world…..

“|” unrecognised error with QProcess in Qt – Solved

leave a comment »

In Qt, QProcess does not recognise the “|” ( pipe ) symbol when the
process is started. We can solve this by doing like this in linux.
In windows, i am sorry i do not have an answer.
Before starting the QProcess ( say for example proc ) ;
proc->start(“your process name here”), open a file and send the
whole command string to that file ( for example open a file called cmd.sh
and send the command string to cmd.sh) and then start your process as
proc->start(“bash cmd.sh”). This will not produce an error “|” unrecognised
and complete the process because it is a shell script.

*( Normally we use system when | does not work with QProcess, but the problem
here is using system, we can not connect a slot for ProgressBar or Progress-
Bar dialog. So by doing running the process as a script now we can connect
the slot of progress bar. :-) ).

** If any better solutions than the above, please mail to ramvvs@gmail.com.

Written by valluryphani

July 8, 2009 at 8:50 am

Posted in Qt Programming.

Leave a Reply