[Qt-interest] how to capture the QProcess output?
Muthulingam Ammaiappan
muthulingam.a at gmail.com
Wed Sep 28 05:45:33 CEST 2011
Hi All,
now it is working fine...
i just replace the
"proc1->startDetached(svnprogram,arguments,workingdirpath);"
into "proc1->start(svnprogram,arguments);"..
thanks to all for your valuable suggestions...
Regards,
Muthu
On Tue, Sep 27, 2011 at 5:21 PM, Thiago Macieira <thiago at kde.org> wrote:
> On Tuesday, 27 de September de 2011 16:53:25 Muthulingam Ammaiappan wrote:
> > Hi Friends,
> >
> > i wanted to capture the QProcess output and show....
> >
> > here is the code snippet ....
>
> Could you please avoid inserting formatting in plain text? Obviously those
> asterisks below aren't part of the source code.
>
> > *QString svnprogram = "./bin/svn.exe";*
> >
> > * QProcess *proc1 = new QProcess( this );*
> >
> > * proc1->setWorkingDirectory(workingdirpath);*
> >
> > * proc1->startDetached(svnprogram,arguments,workingdirpath);*
> >
> > * proc1->waitForFinished();*
> >
> > * // proc1->terminate();*
> >
> > * QByteArray barray = proc1->readAll();*
> >
> > * QString outstr(barray);*
> >
> > * qDebug()<<outstr<<endl;*
> >
> >
> > here svn.exe is called and it works fine... but it did not show the
> output
> > in qDebug()...
> >
> > can anyone please help me to fix this problem..
>
> Your error was to use startDetached. That's a static function. Unlike Java,
> C++ does let you use the context of an object to call a static function.
> But
> to be on the safe side, you should have written:
>
> QProcess::startDetached(svnprogram, arguments, workingdirpath);
>
> if you had done that, you'd have noticed that you never started a process
> in
> proc1. That means startDetached is the wrong function to use. You simply
> wanted start().
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel Open Source Technology Center
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110928/071160f4/attachment.html
More information about the Qt-interest-old
mailing list