Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

process readLine



  • I have use de a qprocess to start a soft "discover.exe", however i cannot read lines with the process. it works before, but now it doesn't work any more.
    Here is part of my code

       QString exePath;
       exePath = ("discover.exe");
    
       addpProcess->start(exePath,QIODevice::ReadWrite);
    
       if( !addpProcess->waitForStarted() ) {
           allOSB_On_Network.insert(0,"impossibletostart");
           return allOSB_On_Network;
       }
       else {
    
               QCoreApplication::processEvents();
               addpProcess->waitForReadyRead(300);
    
               dataReceive=addpProcess->readLine();
                .....
              }
    

    So in my programe, i can not read anything in the parameter dataReceive.It's always empty.
    But if i use directly the function with IP I know i can communicate with the board.

        tcpSocket->connectToHost(IP,2001,QIODevice::ReadWrite);
        tcpSocket->write(datagram);
        tcpSocket->waitForBytesWritten(300);
    
        tcpSocket->waitForReadyRead(300);
        QByteArray temp = tcpSocket->read(1);
    
    

    Anyone knows why? the process cannot read anything?


  • Lifetime Qt Champion

    • it works before, but now it doesn't work any more.

    So what did u change from there till now?

    Anyway, how does "discover.exe" get the IP?


Log in to reply