Dear visitor, welcome to KDE-Forum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Communicating with stdout and stderr
OK hi I've got a question. I start a process with:
|
Source code
|
1
|
makeProc->start (KProcess::NotifyOnExit,KProcess::Stdout);
|
and make connection with:
|
Source code
|
1
|
connect( instProc, SIGNAL( receivedStdout (KProcess * , char *, int) ), this, SLOT( getText(KProcess*, char*, int ) ) );
|
and
|
Source code
|
1
|
connect( instProc, SIGNAL( receivedStderr (KProcess * , char *, int) ), this, SLOT( getErrText(KProcess*, char*, int ) ) );
|
Ok my question: I know that only the first connection works, but how can I start a Kprocess with stdout and stderr?
You have to OR the proper communication flags
|
Source code
|
1
|
process->start(KProcess::NotifyOnExit, KProcess::Stdout | KProcess::Stderr);
|
Cheers,
_
Qt/KDE Developer
Debian User
It doesn't work, I get this error:
|
Source code
|
1
2
|
/comain/src/workform.cpp:127: error: invalid conversion from `int' to `KProcess::Communication'
/comain/src/workform.cpp:127: error: initializing argument 2 of `virtual bool KProcess::start(KProcess::RunMode, KProcess::Communication)'
|
what's the problem?
This post has been edited 1 times, last edit by "dfmax" (Feb 8th 2005, 11:51am)
Argh, sorry!
Use KProcess::AllOutput as the communication mode.
Cheers,
_
Qt/KDE Developer
Debian User
Thanks allot it works
This post has been edited 2 times, last edit by "dfmax" (Feb 9th 2005, 6:54pm)