Unable to read hex bytes from serial interface in Qt Creator



  • I am trying to read the data from modem in Qt through serial interface. While doing so, I am able to read the data till no hex byte is encountered. After that I fail to read the data!

    Sample Code attached here :

    QString a=0,Received_response=0
     if(serialDataAvail(fd))
    {
    a=serialGetchar(fd);
    Received_response.append(a);
     }
    

    Is there any limitation for QString (datatype) that it can't read the hex data?

    Or is there any other method to grab the hex bytes through serial interface in Qt ?


  • Moderators

    @SHUBHAM-SINGH-RAO
    you need to be more specific. But I can say with a high certainty that you're doing stuff wrong, or at the very least not what you want to do.

    What is transferred via serial port?

    Is it ascii characters representing hex values or can it be any arbitrary byte ?


 

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