I want to launch a SCPI command in my device using netcat utility under Ubuntu 10.04 LTS with Qt. My code looks like:
env = \"echo TRIG | nc 192.168.1.100 23
You can't use the pipe command (|) with QProcess that way.
There are a few ways to tackle this: -
You can call the first command and retrieve its output before processing it either in Qt or with another call to QProcess.
Or, create a script that you call from QProcess and retrieve the output.
Finally, assuming you're using linux / OSX, you can call QProcess with /bin/bash and pass the command to that. For example: -
env = "/bin/bash \"echo TRIG | nc 192.168.1.100 23 -q1\"";
process1.execute(env);
You can probably find an equivalent to /bin/bash for windows, perhaps cmd.exe