Results 1 to 3 of 3

Thread: Indirection operator not working from QProcess

  1. #1
    Join Date
    Feb 2009
    Posts
    189
    Thanks
    2

    Default Indirection operator not working from QProcess

    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

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Indirection operator not working from QProcess

    QProcess executes a single process. It does not support shell features such as pipes, redirection, or parameter substitution.

  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Indirection operator not working from QProcess

    However, you can read the output and write it to the file from within your program.

Similar Threads

  1. Replies: 3
    Last Post: 25th February 2009, 16:55
  2. QProcess - Working directory problem
    By jomarin in forum Qt Programming
    Replies: 4
    Last Post: 27th November 2008, 16:26
  3. Qprocess not working
    By bruccutler in forum Newbie
    Replies: 3
    Last Post: 15th February 2007, 04:48
  4. QProcess not working in some cases
    By munna in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2006, 09:58
  5. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 00:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.