[Qt-interest] About QProcess :How to read stdoutput
Princy K. V.
princy.kv at nestgroup.net
Tue May 5 13:15:32 CEST 2009
Thanks for that information...
My app is running in windows..
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of
qt-interest-request at trolltech.com
Sent: Tuesday, May 05, 2009 4:37 PM
To: qt-interest at trolltech.com
Subject: Qt-interest Digest, Vol 6, Issue 48
Send Qt-interest mailing list submissions to
qt-interest at trolltech.com
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.trolltech.com/mailman/listinfo/qt-interest
or, via email, send a message with subject or body 'help' to
qt-interest-request at trolltech.com
You can reach the person managing the list at
qt-interest-owner at trolltech.com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Qt-interest digest..."
Today's Topics:
1. Re: About QProcess :How to read stdoutput realtime?
(chandrasekar wagmare)
----------------------------------------------------------------------
Message: 1
Date: Tue, 5 May 2009 16:36:28 +0530
From: chandrasekar wagmare <sekarwagmare at gmail.com>
Subject: Re: [Qt-interest] About QProcess :How to read stdoutput
realtime?
To: "qt-interest at trolltech.com" <qt-interest at trolltech.com>
Message-ID:
<3bba330b0905050406y569c8b04ge912d9bcd13d5c15 at mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"
no not to flush your Qt code .. check the output of the external
program u
try to run from QProcess ... ex: if u are trying to run application
"a.out"
..
in "a.out" there may be any problem with stdout ...
are u using linux .. if so
run the application with this command
*a.out | less*
and check if it is printing the output in regular interval ...
On Tue, May 5, 2009 at 4:30 PM, Princy K. V.
<princy.kv at nestgroup.net>wrote:
> Hi,
>
> Sorry to interrupt again..
>
> I modified code ..but Start slot never invoked? Why is it so??
>
>
>
> connect(process , SIGNAL(readyRead()) , process, SLOT(Start()));
>
>
>
> void CMainWindow::Start()
>
> {
>
> QByteArray byteArray;
>
> byteArray.resize(2000);
>
> byteArray.clear();
>
> fflush(stdout);
>
> byteArray=process->readAllStandardOutput();
>
> ui->plainTextEdit->appendPlainText(byteArray);
>
> }
>
>
>
> Thanks..
> ------------------------------
>
> *From:* chandrasekar wagmare [mailto:sekarwagmare at gmail.com]
> *Sent:* Tuesday, May 05, 2009 3:33 PM
> *To:* Princy K. V.
> *Subject:* Re: [Qt-interest] About QProcess :How to read stdoutput
> realtime?
>
>
>
> it's a problem of an incorrectly setup buffering method... and
>
> you won't be able to solve this from within your calling program.
> Either "patch" the program you are calling to use line buffering --
> setlinebuf(stdout) -- or use fflush(stdout) every now and then in this
> program. If you can't do this, then there's no way to solve it.
>
> It's NOT a problem of QProcess or anything you could solve by any
trickery
> here... I have similar issues with some of the programs that I call
from
> some
> of my apps and there's no way around it (at least no platform
independent
> one).
> ex: i am using linux to run an external system call glxgears in
QProcess
> and i get output after ten minutes only or when the buffer filled
completly
> ..
> i try this one "glxgears | less" and find the problem in
buffer
> flush
>
> On Tue, May 5, 2009 at 2:43 PM, Princy K. V. <princy.kv at nestgroup.net>
> wrote:
>
> Hi,
>
> Thanks for ur reply.
>
> But slot is not invoked when I used these signals
*readyReadStandardError
> * <http://qprocess.html#readyReadStandardError> () & *
> readyReadStandardOutput*
<http://qprocess.html#readyReadStandardOutput> (
>
> ..so I used following code snippets, this consumes lot of
time..sometimes
> not getting desired output..
>
>
>
> void CMainWindow::Run()
>
> {
>
> QByteArray byteArray;
>
> byteArray.resize(2000);
>
> byteArray.clear();
>
> ui->plainTextEdit->setEnabled(true);
>
> ui->plainTextEdit->clear();
>
> while(!Start())
>
> {
>
> //progress->hide();
>
> byteArray.clear();
>
> byteArray=process->readAllStandardOutput();
>
> ui->plainTextEdit->appendPlainText(byteArray);
>
> }
>
> }
>
>
>
> void CMainWindow::Start()
>
> {
>
> ??.
>
> process->start("xx.exe" ,arguments);
>
> if (!process->waitForStarted())
>
> return false;
>
> // ui->statusBar->addPermanentWidget(progress , 0);
>
> if(!process->waitForFinished())
>
> {
>
> //progress->setMinimum(0);
>
> //progress->setMaximum(0);
>
> //progress->show();
>
> return false;
>
> }
>
> ??
>
> return true;
>
> }
>
>
>
>
>
>
> ------------------------------
>
>
>
> u are using this signals right ,
>
> void
*readyReadStandardError*<http://qprocess.html#readyReadStandardError>()
>
> void
*readyReadStandardOutput*<http://qprocess.html#readyReadStandardOutput>(
)
>
>
>
> On Tue, May 5, 2009 at 1:04 PM, Princy K. V. <princy.kv at nestgroup.net>
> wrote:
>
> Hi,
> I m new to Qt.I want to display datas that are written on stdoutput
by
> an external process on my gui. I have started external process using
> Qprocess. I can display all stdoutput data by calling,
> byteArray=process->readAllStandardOutput();
> ui->plainTextEdit->appendPlainText(byteArray);
> But my reqiurment is to display data(line by line) same time it is
> written on stdoutput.i have tried many methods.so far didn't get
> required output..
> Please suggest me some solutions..
> Thanks..
> ***** Confidentiality Statement/Disclaimer *****
>
> This message and any attachments is intended for the sole use of the
> intended recipient. It may contain confidential information. Any
> unauthorized use, dissemination or modification is strictly
prohibited. If
> you are not the intended recipient, please notify the sender
immediately
> then delete it from all your systems, and do not copy, use or print.
> Internet communications are not secure and it is the responsibility of
the
> recipient to make sure that it is virus/malicious code exempt.
> The company/sender cannot be responsible for any unauthorized
alterations
> or modifications made to the contents. If you require any form of
> confirmation of the contents, please contact the company/sender. The
> company/sender is not liable for any errors or omissions in the
content of
> this message.
> ***** Confidentiality Statement/Disclaimer *****
>
> This message and any attachments is intended for the sole use of the
> intended recipient. It may contain confidential information. Any
> unauthorized use, dissemination or modification is strictly
prohibited. If
> you are not the intended recipient, please notify the sender
immediately
> then delete it from all your systems, and do not copy, use or print.
> Internet communications are not secure and it is the responsibility of
the
> recipient to make sure that it is virus/malicious code exempt.
>
> The company/sender cannot be responsible for any unauthorized
alterations
> or modifications made to the contents. If you require any form of
> confirmation of the contents, please contact the company/sender. The
> company/sender is not liable for any errors or omissions in the
content of
> this message.
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
> --
> WAGMARE
>
> ***** Confidentiality Statement/Disclaimer *****
>
> This message and any attachments is intended for the sole use of the
> intended recipient. It may contain confidential information. Any
> unauthorized use, dissemination or modification is strictly
prohibited. If
> you are not the intended recipient, please notify the sender
immediately
> then delete it from all your systems, and do not copy, use or print.
> Internet communications are not secure and it is the responsibility of
the
> recipient to make sure that it is virus/malicious code exempt.
> The company/sender cannot be responsible for any unauthorized
alterations
> or modifications made to the contents. If you require any form of
> confirmation of the contents, please contact the company/sender. The
> company/sender is not liable for any errors or omissions in the
content of
> this message.***** Confidentiality Statement/Disclaimer *****
>
> This message and any attachments is intended for the sole use of the
> intended recipient. It may contain confidential information. Any
> unauthorized use, dissemination or modification is strictly
prohibited. If
> you are not the intended recipient, please notify the sender
immediately
> then delete it from all your systems, and do not copy, use or print.
> Internet communications are not secure and it is the responsibility of
the
> recipient to make sure that it is virus/malicious code exempt.
>
> The company/sender cannot be responsible for any unauthorized
alterations
> or modifications made to the contents. If you require any form of
> confirmation of the contents, please contact the company/sender. The
> company/sender is not liable for any errors or omissions in the
content of
> this message.
>
>
>
>
> --
> WAGMARE
> ***** Confidentiality Statement/Disclaimer *****
>
> This message and any attachments is intended for the sole use of the
> intended recipient. It may contain confidential information. Any
> unauthorized use, dissemination or modification is strictly
prohibited. If
> you are not the intended recipient, please notify the sender
immediately
> then delete it from all your systems, and do not copy, use or print.
> Internet communications are not secure and it is the responsibility of
the
> recipient to make sure that it is virus/malicious code exempt.
> The company/sender cannot be responsible for any unauthorized
alterations
> or modifications made to the contents. If you require any form of
> confirmation of the contents, please contact the company/sender. The
> company/sender is not liable for any errors or omissions in the
content of
> this message.***** Confidentiality Statement/Disclaimer *****
>
> This message and any attachments is intended for the sole use of the
> intended recipient. It may contain confidential information. Any
> unauthorized use, dissemination or modification is strictly
prohibited. If
> you are not the intended recipient, please notify the sender
immediately
> then delete it from all your systems, and do not copy, use or print.
> Internet communications are not secure and it is the responsibility of
the
> recipient to make sure that it is virus/malicious code exempt.
>
> The company/sender cannot be responsible for any unauthorized
alterations
> or modifications made to the contents. If you require any form of
> confirmation of the contents, please contact the company/sender. The
> company/sender is not liable for any errors or omissions in the
content of
> this message.
>
--
WAGMARE
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.trolltech.com/pipermail/qt-interest/attachments/20090505/e2
52eb0e/attachment.html
------------------------------
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
End of Qt-interest Digest, Vol 6, Issue 48
******************************************
***** Confidentiality Statement/Disclaimer *****
This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt.
The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message.
***** Confidentiality Statement/Disclaimer *****
This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt.
The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message.
More information about the Qt-interest-old
mailing list