Help to analyze /convert "command string "
-
wrote on 19 Feb 2024, 01:01 last edited by
This is my command string passed to "system".
It works as expected, but...
I need to use QProcess defined asmyProcess->start(program, arguments);
"echo q | sudo -S hcitool info 98:D3:31:F8:39:33";
My question to the forum
what is my "program " echo ??
how to code the arguments ?echo, QStringList << q << "|"
<< sudo ??ADDENDUM
I did try this, it does what it is instructed to do
just "echo" the command line.
Could somebody kindly please help me to write correct command (program) and its arguments ?QProcess *QP = new QProcess(); QP->start(" echo q | sudo -S hcitool info 98:D3:31:F8:39:33 ") ; if(QP->waitForStarted()) { text = "SUCCESS started"; ui->textEdit->append(text); qDebug() << text; if(QP->waitForReadyRead()) { text = "SUCCESS waitForReadyRead() OK "; ui->textEdit->append(text); qDebug() << text; text = QP->readAllStandardOutput(); ui->textEdit->append(text); qDebug() << text; } } else { text = " FAILED start "; } qDebug() << text; return;
-
This is my command string passed to "system".
It works as expected, but...
I need to use QProcess defined asmyProcess->start(program, arguments);
"echo q | sudo -S hcitool info 98:D3:31:F8:39:33";
My question to the forum
what is my "program " echo ??
how to code the arguments ?echo, QStringList << q << "|"
<< sudo ??ADDENDUM
I did try this, it does what it is instructed to do
just "echo" the command line.
Could somebody kindly please help me to write correct command (program) and its arguments ?QProcess *QP = new QProcess(); QP->start(" echo q | sudo -S hcitool info 98:D3:31:F8:39:33 ") ; if(QP->waitForStarted()) { text = "SUCCESS started"; ui->textEdit->append(text); qDebug() << text; if(QP->waitForReadyRead()) { text = "SUCCESS waitForReadyRead() OK "; ui->textEdit->append(text); qDebug() << text; text = QP->readAllStandardOutput(); ui->textEdit->append(text); qDebug() << text; } } else { text = " FAILED start "; } qDebug() << text; return;
Dupe of https://forum.qt.io/topic/154632
-
-
1/2