Results 1 to 4 of 4

Thread: setstandardoutputprocess vs piped shell script

  1. #1
    Join Date
    Oct 2009
    Posts
    4

    Default setstandardoutputprocess vs piped shell script

    i need to read out the signal strength of a modem to my qt program like this:

    Qt Code:
    1. echo at+csq > /dev/ttyUSB2 | head -n 4 /dev/ttyUSB2
    To copy to clipboard, switch view to plain text mode 


    which is the best to use:

    Qprocess::setStandardOutputProcess with two Qprocesses, one for "echo at+csq > /dev/ttyUSB2" and one for "head -n 4 /dev/ttyUSB2 " or a single Qprocess that runs a shell script with pipe

    Like this

    Qt Code:
    1. #!/bin/bash
    2.  
    3. echo at+csq > /dev/ttyUSB2 | head -n 4 /dev/ttyUSB2
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: setstandardoutputprocess vs piped shell script

    Neither of them. If you have a native C++ application, you should not depend on bash. Open the device directly in Qt.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Oct 2009
    Posts
    4

    Default Re: setstandardoutputprocess vs piped shell script

    How do i do that?

  4. #4
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: setstandardoutputprocess vs piped shell script

    I think QFile is your friend.
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. Whats wrong with this script -- help needed
    By swamyonline in forum Qt Programming
    Replies: 5
    Last Post: 2nd July 2009, 13:17
  2. Qt Script
    By c_srikanth1984 in forum Qt Programming
    Replies: 3
    Last Post: 9th June 2009, 10:35
  3. Can I include a script from script?
    By yycking in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 03:01
  4. Call script shell with Qt
    By zeeb100 in forum Qt Programming
    Replies: 6
    Last Post: 26th February 2009, 09:17
  5. How to use shell script files ?
    By npc in forum Newbie
    Replies: 3
    Last Post: 15th February 2007, 08:26

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.