PDA

View Full Version : Writing to Qprocess after its alreaedy stared



jesse_mark
3rd August 2012, 02:09
I start an application using Qprocess and i got all the output the application print,

But as the application after its started can take some commands such as "STATUS" and print out the status of my application ,

I tried using "Write" to the Qprocess i started but i didn't get any response back ?? am i using the wrong way ? or how can i do it ??

BTW: i can receive all the singles that are emitted by the Qprocess so either error or output it would be received and printed.

ecanela
3rd August 2012, 06:53
What you mean with "already started", a QProcess ia a thin wrapper for use a external program in a command line, at least i use qprocess in that way, all the data are passed as argument. i dont write data "on the fly" .

post some code who reproduce the problem.

amleto
3rd August 2012, 13:56
normally you have to put a line-end at the end of your command,

e.g.
process.write("STATUS\n");

jesse_mark
4th August 2012, 00:13
@ecanela, Yeah Qprocess as you said, but its not as one command and one time, the argumnets this when the applications need arguments to run in the first time.
but qprocess allow use to write to it after its started , so if your application you started takes input after you start it (e.g. after a while of running it) we still can write to it.

@Amleto , Thanks that is what i was missing .. my bad... but i wonder why when i gave the start command i do not need to put with the command "\n" or "\n\r" ??

Thanks :)