@AnneRanch said in Cannot get the QProcess started:
process.startDetached("hcitool dev>>/tmp/temp");
Apart from @KroMignon's correct point that you should not change to startDetached().
>> I believe you will find that your statement is not working, and you are mistaken in thinking it does. <<
I tested process.startDetached("ls -l >>/tmp/temp"); under Ubuntu 20.04, with Qt 5.12.x. After executing your line, if you look in QT Creator's Application Output pane you get:
/usr/bin/ls: cannot access '>>/tmp/temp': No such file or directory
Then I tried process.startDetached("hcitool dev>>/tmp/temp"); and the Application Output showed just
Devices:
In neither case is /tmp/temp created or written to.
This is exactly as I would expect and have previously said above: you cannot use a redirection symbol like >> without going via a shell (/bin/sh or /bin/bash followed by -c and then the command). Which is what this whole thread is about. Since you don't, the command (ls or hcitool) sees a single argument of >>/tmp/temp, and cannot act on it correctly.
I would guess you had the file /tmp/temp already created from a previous run, filled with previous hcitool output, and thought that meant your command had been successful and appended to it, but it had not. Start by rm /tmp/temp to ENSURE that file does not exist, and then try your startDetached() command again. It does NOT create that file, does it...?