Append a QByteArray to QDataStream?
I have to populate a QByteArray with different data. So I'm using the QDataStream . QByteArray buffer; QDataStream stream(&buffer, QIODevice::WriteOnly); qint8 dataHex= 0x04; qint8 dataChar = 'V'; stream << dataHex<< dataChar; qDebug() << buffer.toHex(); // "0456" This is what I want However, I would also like to append a QByteArray to the buffer . QByteArray buffer; QDataStream stream(&buffer, QIODevice::WriteOnly); qint8 dataHex= 0x04; qint8 dataChar = 'V'; QByteArray moreData = QByteArray::fromHex("ff"); stream << dataHex<< dataChar << moreData.data(); // char * QByteArray::data () qDebug()