[Qt-interest] Error encountered while using void setStandardOutputProcess ( QProcess * destination )
Usman Ajmal
uzmanajmal at gmail.com
Tue Jul 21 20:01:52 CEST 2009
That's not working too. Now i am getting a message "QProcess: Destroyed
while process is still running."
I am actually sending memory image from one machine to another. When i do it
in simple shell it works fine.
Client's Shell: netcat -l -p 9001 | dd of=mem.img
Server's Shell: dd if=/dev/mem | netcat 192.168.25.76 9001
where 192.168.25.76 is the IP address of client and 9001 is the port number.
I first run the piped command on client and then the server's. Image gets
transfer smoothly.
But now i am trying to provide a GUI for the server. Such that the user will
have to enter only ip address in the lineEdit. The client however runs in
shell as earlier. I used following code but its giving the said message
while not transferring anything.
....
QObject::connect(pushButton_send, SIGNAL(clicked()), MainWindow,
SLOT(sendImage()));
....
void MainWindow::sendImage()
{
QObject *parent;
QString command1 = "dd if=/dev/mem";
QString command2 = "netcat ";
QStringList arguments;
arguments<<lineEdit_ipAddr->text()<<"9001";
QProcess process1;
QProcess *process2 = new QProcess(parent);
process1.setStandardOutputProcess(process2);
QCoreApplication::processEvents();
process1.start(command1);
process2->start(command2, arguments);
}
Any suggestions for me?
On Tue, Jul 21, 2009 at 6:20 PM, Chandru... <sekarwagmare at gmail.com> wrote:
> initialize second QProcess as a pointer ..
> QProcess *process2;
>
> then in your code
> command2.append(lineEdit_ipAddr->text()); // its a bad way
>
> use QStringlist
> QStringList argument
> argument << lineEdit_ipAddr->text();
>
> void start <http://qprocess.html#start> ( const QString & program, const
> QStringList & arguments, OpenMode mode = ReadWrite )
>
>
>
>
>
> On Tue, Jul 21, 2009 at 6:29 PM, Usman Ajmal <uzmanajmal at gmail.com> wrote:
>
>> Hi,
>>
>> I am getting following error
>>
>> MainWindow.cpp:85: error: no matching function for call to
>> ‘QProcess::setStandardOutputProcess(QProcess&)’
>> /usr/include/QtCore/qprocess.h:113: note: candidates are: void
>> QProcess::setStandardOutputProcess(QProcess*)
>> make: *** [MainWindow.o] Error 1
>> for the following line of codes...Any idea why can't i access
>> setStandardOutputProcess
>>
>> QString command1 = "dd if=/dev/mem";
>> QString command2 = "netcat ";
>> command2.append(lineEdit_ipAddr->text()); //This line edit contain ip
>> address to which i am sending the image of memory taken with the help of dd
>> command2.append(" 9001");
>>
>> QProcess process1;
>> QProcess process2;
>> process1.setStandardOutputProcess(process2);
>> QCoreApplication::processEvents();
>> process1.start(command1);
>> process2.start(command2);
>>
>> Please tell me what am i missing.
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
>
> --
> WAGMARE
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090721/2435ebd0/attachment.html
More information about the Qt-interest-old
mailing list