You are not logged in.

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.

dfmax

Beginner

  • "dfmax" started this thread

Posts: 13

Location: Slovenia

  • Send private message

1

Tuesday, February 1st 2005, 7:22pm

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?

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Saturday, February 5th 2005, 2:02pm

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

dfmax

Beginner

  • "dfmax" started this thread

Posts: 13

Location: Slovenia

  • Send private message

3

Monday, February 7th 2005, 7:14pm

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)


anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Tuesday, February 8th 2005, 6:13pm

Argh, sorry!

Use KProcess::AllOutput as the communication mode.

Cheers,
_
Qt/KDE Developer
Debian User

dfmax

Beginner

  • "dfmax" started this thread

Posts: 13

Location: Slovenia

  • Send private message

5

Wednesday, February 9th 2005, 6:08pm

Thanks allot it works :)

This post has been edited 2 times, last edit by "dfmax" (Feb 9th 2005, 6:54pm)