setstandardoutputprocess vs piped shell script
i need to read out the signal strength of a modem to my qt program like this:
Code:
echo at+csq > /dev/ttyUSB2 | head -n 4 /dev/ttyUSB2
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
Code:
#!/bin/bash
echo at+csq > /dev/ttyUSB2 | head -n 4 /dev/ttyUSB2
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.
Re: setstandardoutputprocess vs piped shell script
Re: setstandardoutputprocess vs piped shell script
I think QFile is your friend.