Results 1 to 4 of 4

Thread: QProcess

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Unhappy QProcess

    Hi ALL,

    I am using Qt4.2.3.

    In my code , I have started a QProcess and reading Stderr and posting it to the GUI.While reading Stderr at one condition i have to start another QProcess and read Stderr.As Follows.

    Qt Code:
    1. void Config::readFromStderr()
    2. {
    3. while(( length = proc->readLine(buf,sizeof(buf))) != -1 && !(START_FLAG))
    4. {
    5. dat = (QString)buf;
    6.  
    7. if(dat.indexOf(" Manager configuration file loaded", 0 , Qt::CaseInsensitive) != -1)
    8. {
    9. proc1 = new QProcess(this);
    10. connect(proc1, SIGNAL(readyReadStandardError()), this, SLOT(readFromStderr1()));
    11. proc1->start(home1,list1,QIODevice::ReadWrite);
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 
    }

    first time if i run , first process is running and after that second process is running successfully and i can read the data from Stderr from both the processes.

    second time if i run, first process is running , but i can't read the data from Stderr.
    Why is that i can't read the data from Stderr ??

  2. #2
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    61
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    Quote Originally Posted by bashamehboob View Post

    Qt Code:
    1. void Config::readFromStderr()
    2. {
    3. while(( length = proc->readLine(buf,sizeof(buf))) != -1 && !(START_FLAG))
    4. {
    5. dat = (QString)buf;
    6.  
    7. if(dat.indexOf(" Manager configuration file loaded", 0 , Qt::CaseInsensitive) != -1)
    8. {
    9. proc1 = new QProcess(this);
    10. connect(proc1, SIGNAL(readyReadStandardError()), this, SLOT(readFromStderr1()));
    11. proc1->start(home1,list1,QIODevice::ReadWrite);
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 
    }
    To start proc1 you should test whether the implementation proc ended. Use:

    Qt Code:
    1. if (proc->waitForFinished())
    2. proc1->start(home1,list1,QIODevice::ReadWrite);
    To copy to clipboard, switch view to plain text mode 
    Last edited by jaca; 16th May 2008 at 23:20.

  3. #3
    Join Date
    Apr 2006
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QProcess

    Hi ,

    I require proc to be in running state because, After starting proc1, it would be communicating with proc.

    Is this correct way of doing ??
    Or I am going wrong ??

  4. #4
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    61
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    You can put here as you are stating the proc?
    put a little more than code because I am not well understood.

Similar Threads

  1. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2007, 23:11
  2. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  3. Replies: 1
    Last Post: 6th March 2007, 15:27
  4. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

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
  •  
Qt is a trademark of The Qt Company.