Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. I need extra set of eyes , please....

I need extra set of eyes , please....

Scheduled Pinned Locked Moved Unsolved C++ Gurus
2 Posts 2 Posters 315 Views 1 Watching
  • 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 last edited by
    #1

    The attached code misbehaves...
    1, It passes and runs OK the FIRST set of

     // verify list
        for (auto  verify_list : verify) {
            text = "verify list  ";
            text += verify_list;
            qDebug()  << text;
        }
    

    On SECOND set it complains about "missing expression"

    1. It gives no error on THIRD set of SAME code block

    It won't identify the while ( ); block correctly - after clicking AFTER first "(" it goes all the way to the beginning of the function...not to the last ")" .

    and won't "auto indent "

    I just do not see the error (s) .

    text = "Process command...";
    text += Q_FUNC_INFO;
    qDebug() << text;
    //#ifdef BYPASS
    // verify list
    for (auto verify_list : verify) {
    text = "verify list ";
    text += verify_list;
    qDebug() << text;
    }
    //#endif
    time = new QTime();
    QString result;
    // run QProcess first time
    time->start();
    QP = new QProcess();
    qDebug() << "DEBUG TRACE start new QProcess();";
    text = "DEBUG TRACE start new QProcess();";
    //TRACE_TextEdit->addItem(text);
    qDebug() << text;
    //text = " command ";
    text = command;
    // add file
    text += " | tee /tmp/temp";
    // qDebug() << text" | tee /tmp/temp";;
    //command += " | tee /tmp/temp";
    QP->start("/bin/sh", QStringList() << "-c" << command);
    if(QP->Running)
    {
    text = "QProcess running..";
    qDebug() << text;
    }

        do
        {
            text = "Process loop ";
            qDebug() <<text;
            result = QP->readAllStandardOutput();
            qDebug() << result;
            if(  QP->waitForFinished(100))
            {
                if(QP->waitForReadyRead())                      // QP->waitForFinished(5000) | QP->waitForReadyRead())
                {
                    text = "QProcess waitForReadyRead()";
                    qDebug() << text;
                    result = QP->readAllStandardOutput();
                }
            }
        }
        while
                (   start here 
                 // iterate list
                 // verify list
                 for (auto  verify_list : verify) {
                 text = "verify list  ";
                 text += verify_list;
                 qDebug()  << text;
    }
                 
                 for (auto  verify_list : verify)
        {
                 
                 if(!result.contains(verify_list))
        {
                 text = "verify list  ";
                 text += verify_list;
                 qDebug()  << text;
                 
                 //continue; // break;
    }
                 else
        {
                 text = "verify list  ";
                 text += verify_list;
                 qDebug()  << text;
    }
                 
    }
                 );   should stop here !!!! 
        
        text = "DONE  Process loop ";
        qDebug() <<text;
    
        // changing verify to list
        QString BT_Utility_Library::ProcessCommand ( char* command, QStringList verify )
        {
            text = "Process command...";
            text += Q_FUNC_INFO;
            qDebug() << text;
    //#ifdef BYPASS
            // verify list
            for (auto  verify_list : verify) {
                text = "verify list  ";
                text += verify_list;
                qDebug()  << text;
            }
    //#endif
            time = new QTime();
            QString result;
            // run QProcess first time
            time->start();
            QP = new QProcess();
            qDebug() << "DEBUG TRACE start new QProcess();";
            text = "DEBUG TRACE start new QProcess();";
            //TRACE_TextEdit->addItem(text);
            qDebug() << text;
            //text = " command ";
            text = command;
            // add file
            text += " | tee /tmp/temp";
            // qDebug() << text" | tee /tmp/temp";;
            //command += " | tee /tmp/temp";
            QP->start("/bin/sh", QStringList() << "-c" << command);
            if(QP->Running)
            {
                text = "QProcess running..";
                qDebug() << text;
            }
    
    
            do
            {
                text = "Process loop ";
                qDebug() <<text;
                result = QP->readAllStandardOutput();
                qDebug() << result;
                if(  QP->waitForFinished(100))
                {
                    if(QP->waitForReadyRead())                      // QP->waitForFinished(5000) | QP->waitForReadyRead())
                    {
                        text = "QProcess waitForReadyRead()";
                        qDebug() << text;
                        result = QP->readAllStandardOutput();
                    }
                }
            }
            while
                    (
                     // iterate list
                     // verify list
                     for (auto  verify_list : verify) {
                         text = "verify list  ";
                         text += verify_list;
                         qDebug()  << text;
                     }
    
                     for (auto  verify_list : verify)
            {
    
                     if(!result.contains(verify_list))
            {
                     text = "verify list  ";
                     text += verify_list;
                     qDebug()  << text;
    
                     //continue; // break;
        }
                     else
            {
                     text = "verify list  ";
                     text += verify_list;
                     qDebug()  << text;
        }
    
        }
                     );
    
            text = "DONE  Process loop ";
            qDebug() <<text;
            // temp end
        }
    
    
    JonBJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      The attached code misbehaves...
      1, It passes and runs OK the FIRST set of

       // verify list
          for (auto  verify_list : verify) {
              text = "verify list  ";
              text += verify_list;
              qDebug()  << text;
          }
      

      On SECOND set it complains about "missing expression"

      1. It gives no error on THIRD set of SAME code block

      It won't identify the while ( ); block correctly - after clicking AFTER first "(" it goes all the way to the beginning of the function...not to the last ")" .

      and won't "auto indent "

      I just do not see the error (s) .

      text = "Process command...";
      text += Q_FUNC_INFO;
      qDebug() << text;
      //#ifdef BYPASS
      // verify list
      for (auto verify_list : verify) {
      text = "verify list ";
      text += verify_list;
      qDebug() << text;
      }
      //#endif
      time = new QTime();
      QString result;
      // run QProcess first time
      time->start();
      QP = new QProcess();
      qDebug() << "DEBUG TRACE start new QProcess();";
      text = "DEBUG TRACE start new QProcess();";
      //TRACE_TextEdit->addItem(text);
      qDebug() << text;
      //text = " command ";
      text = command;
      // add file
      text += " | tee /tmp/temp";
      // qDebug() << text" | tee /tmp/temp";;
      //command += " | tee /tmp/temp";
      QP->start("/bin/sh", QStringList() << "-c" << command);
      if(QP->Running)
      {
      text = "QProcess running..";
      qDebug() << text;
      }

          do
          {
              text = "Process loop ";
              qDebug() <<text;
              result = QP->readAllStandardOutput();
              qDebug() << result;
              if(  QP->waitForFinished(100))
              {
                  if(QP->waitForReadyRead())                      // QP->waitForFinished(5000) | QP->waitForReadyRead())
                  {
                      text = "QProcess waitForReadyRead()";
                      qDebug() << text;
                      result = QP->readAllStandardOutput();
                  }
              }
          }
          while
                  (   start here 
                   // iterate list
                   // verify list
                   for (auto  verify_list : verify) {
                   text = "verify list  ";
                   text += verify_list;
                   qDebug()  << text;
      }
                   
                   for (auto  verify_list : verify)
          {
                   
                   if(!result.contains(verify_list))
          {
                   text = "verify list  ";
                   text += verify_list;
                   qDebug()  << text;
                   
                   //continue; // break;
      }
                   else
          {
                   text = "verify list  ";
                   text += verify_list;
                   qDebug()  << text;
      }
                   
      }
                   );   should stop here !!!! 
          
          text = "DONE  Process loop ";
          qDebug() <<text;
      
          // changing verify to list
          QString BT_Utility_Library::ProcessCommand ( char* command, QStringList verify )
          {
              text = "Process command...";
              text += Q_FUNC_INFO;
              qDebug() << text;
      //#ifdef BYPASS
              // verify list
              for (auto  verify_list : verify) {
                  text = "verify list  ";
                  text += verify_list;
                  qDebug()  << text;
              }
      //#endif
              time = new QTime();
              QString result;
              // run QProcess first time
              time->start();
              QP = new QProcess();
              qDebug() << "DEBUG TRACE start new QProcess();";
              text = "DEBUG TRACE start new QProcess();";
              //TRACE_TextEdit->addItem(text);
              qDebug() << text;
              //text = " command ";
              text = command;
              // add file
              text += " | tee /tmp/temp";
              // qDebug() << text" | tee /tmp/temp";;
              //command += " | tee /tmp/temp";
              QP->start("/bin/sh", QStringList() << "-c" << command);
              if(QP->Running)
              {
                  text = "QProcess running..";
                  qDebug() << text;
              }
      
      
              do
              {
                  text = "Process loop ";
                  qDebug() <<text;
                  result = QP->readAllStandardOutput();
                  qDebug() << result;
                  if(  QP->waitForFinished(100))
                  {
                      if(QP->waitForReadyRead())                      // QP->waitForFinished(5000) | QP->waitForReadyRead())
                      {
                          text = "QProcess waitForReadyRead()";
                          qDebug() << text;
                          result = QP->readAllStandardOutput();
                      }
                  }
              }
              while
                      (
                       // iterate list
                       // verify list
                       for (auto  verify_list : verify) {
                           text = "verify list  ";
                           text += verify_list;
                           qDebug()  << text;
                       }
      
                       for (auto  verify_list : verify)
              {
      
                       if(!result.contains(verify_list))
              {
                       text = "verify list  ";
                       text += verify_list;
                       qDebug()  << text;
      
                       //continue; // break;
          }
                       else
              {
                       text = "verify list  ";
                       text += verify_list;
                       qDebug()  << text;
          }
      
          }
                       );
      
              text = "DONE  Process loop ";
              qDebug() <<text;
              // temp end
          }
      
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @AnneRanch
      Your first for (auto verify_list : verify) is a statement, which is fine. Your subsequent ones are placed inside the while ( condition of a do ... while ( loop. You cannot use a for statement for a condition, any more than you could write if ( for ( .... I don't know what you are trying achieve putting a loop into a while condition.

      1 Reply Last reply
      0

      • Login

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