Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help to analyze /convert "command string "

Help to analyze /convert "command string "

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 150 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on 19 Feb 2024, 01:01 last edited by
    #1

    This is my command string passed to "system".
    It works as expected, but...
    I need to use QProcess defined as

    myProcess->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;
    
    
    C 1 Reply Last reply 19 Feb 2024, 05:15
    0
    • A Anonymous_Banned275
      19 Feb 2024, 01:01

      This is my command string passed to "system".
      It works as expected, but...
      I need to use QProcess defined as

      myProcess->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;
      
      
      C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 19 Feb 2024, 05:15 last edited by
      #2

      Dupe of https://forum.qt.io/topic/154632

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • C Christian Ehrlicher locked this topic on 19 Feb 2024, 05:16
      • J JonB referenced this topic on 19 Feb 2024, 08:42

      1/2

      19 Feb 2024, 01:01

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved