the error of sending the commend to console from qt program



  • Hi, i'm using qt5.5 on my computer.
    I wanna send the commend like this /home/try.sh to my console.
    This is what my try.sh do inside.

    /usr/bin/ioctl weeprom 0 /home/MAC_addr.txt 256
    

    And i have try it directly through the console and it works right!

    But when i using QProccess to send the commend will always show the wrong information to me like below.

    ioctl: Bad address\n\nAX88179/AX88178A Linux EEPROM/eFuse Programing Tool v1.1.0\n
    

    And this is the program that i write in my QT APP.

     QProcess *save=new QProcess(this);
                        save->setProcessChannelMode(QProcess::MergedChannels);//victor add send command to console to sync the system
                        save->start("/home/try.sh");//victor add
    
                        if(!save->waitForStarted())//victor add
                           qWarning() << "cannaot start process";
                        ret=save->waitForFinished();
                        if(ret)
                        {
    
                            info=QString(save->readAllStandardOutput());
                        }
                        qDebug() << info;
                        delete save;
    

    Where did i doing wrong?
    Please Help!


  • Lifetime Qt Champion

    Hi,

    Can you share the content of your script ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.