Results 1 to 4 of 4

Thread: Writing to Qprocess after its alreaedy stared

  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Writing to Qprocess after its alreaedy stared

    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.

  2. #2
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Thanks
    6
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Writing to Qprocess after its alreaedy stared

    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.

  3. #3
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Writing to Qprocess after its alreaedy stared

    normally you have to put a line-end at the end of your command,

    e.g.
    process.write("STATUS\n");
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  4. #4
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Writing to Qprocess after its alreaedy stared

    @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

  5. The following user says thank you to jesse_mark for this useful post:

    ecanela (26th April 2014)

Similar Threads

  1. file not writing
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2011, 23:01
  2. Writing to a txt file
    By nagabathula in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2011, 11:59
  3. Need help writing my first Qt app
    By netnut in forum Newbie
    Replies: 4
    Last Post: 16th December 2010, 10:52
  4. Replies: 0
    Last Post: 26th August 2010, 10:44
  5. QProcess inside QProcess
    By bunjee in forum Qt Programming
    Replies: 7
    Last Post: 4th December 2008, 00:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.