Writing QByteArray with QTcpSocket: null terminated?



  • Hi,

    probably an easy question for many here, but when I write a QByteArray to a QTcpSocket using the write(const QByteArray &) method, will the written data be null-terminated or not? From the documentation I see that QByteArray is implicitly null-terminated but I do not want the termination byte to go onto the network.

    My workaround would be to use QTcpSocket::write(QByteArray::constData(), QByteArray::size()) but perhaps there is an easier way to do it.

    Thanks.



  • According to qiodevice.h:

    inline qint64 write(const QByteArray &data)
    { return write(data.constData(), data.size()); }



  • Ok, that's the same then, thanks.


Log in to reply
 

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