Important: Please read the Qt Code of Conduct -

QSerialPort 5.2 and write function?

  • I'm facing a problem with write function. Every time I send "Q" to Hyperterminal or putty, I receive "QQ". This is my code for this function.

    @if ( choice == 1 ){

    if ( port->waitForBytesWritten(-1) && port->clear() )
    qDebug() << "Data has been send successfully...";
    qDebug() << "Data hasn't been send successfully...";


    I've tested the code in Hyperterminal and putty, so I think the problem with Qt. I'm using Windows 7 and Qt 5,2. The compiler mingw32-make

  • Never mind. The problem was HDD Virtual Serial Port. It has nothing to do with Qt or Hyperterminal

  • Qt Champions 2020

    You are sure that problem is in "HDD Virtual Serial Port." ? Can you repeat your code in non-blocking manner (without call of waitForBytesWritten(())?


    void YourClass::handleButtonClickedSlot()


  • I've tried this but I'm only able to send just one time after I can't send any more unless I use waitForBytesWritten(-1) or clear() . It seems that write() is in a blocking mode even though in the documentation "here": it states that write() is in non blocking mode. I have no idea why this happens.

Log in to reply