Results 1 to 4 of 4

Thread: QProcess to interact with a command-line based windows executable on linux

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QProcess to interact with a command-line based windows executable on linux

    Qt Code:
    1. QObject *parent;
    2. ....
    3. QString arguments;
    4. arguments <<"-e" << "wine ./{path to exe}/{name}.exe"; // stuff in {} is specific to my program. the path and name is correct.
    5. QProcess *myProcess = new QProcess(parent); // this might be unnecessarily complicated with the parent.
    6. myProcess->start("xterm",arguments); // here the windows executable command line interface shows up on the new terminal.
    7. myProcess->write("1\n"); // THIS AND BELOW DON'T WORK. using the wait until complete function doesn't help
    8. myProcess->write(" {dev IP address} 0/n");
    9. myProcess->write("19/n");
    10. myProcess->write("20000/n");
    11. <here I'm expecting to see data streaming on the terminal>
    To copy to clipboard, switch view to plain text mode 
    Line 7: Windows applications expect CR LF ("\r\n") not just LF ('\n');
    Line 8, 9, and 10: "/n" is not a new line.

  2. The following user says thank you to ChrisW67 for this useful post:

    AnnM (31st July 2013)

Similar Threads

  1. Execute window command line-by-line using QProcess
    By nhocjerry in forum Qt Programming
    Replies: 5
    Last Post: 30th July 2013, 12:21
  2. Replies: 7
    Last Post: 15th November 2010, 09:00
  3. Replies: 0
    Last Post: 28th June 2010, 01:29
  4. Replies: 3
    Last Post: 23rd February 2010, 04:33
  5. QProcess and the command line
    By auba in forum Qt Programming
    Replies: 17
    Last Post: 27th May 2009, 10: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.