[Qt-interest] Adding quint32 to a QByteArray

Francisco Gonzalez gzmorell at gmail.com
Tue Sep 7 20:24:12 CEST 2010


Hello,
Afaik QByteArray class have not a function to add a quint32 data directly at
some position, (nor any other integer, float or doble types) in a platform
independent manner.
Instead it is possible to do:

quint32 number = anyNumber;
qint64 position = anyPositionNumber;
QByteArray array;
QDataStream stream(QByteArray& array, QIODevice::ReadWrite);
stream.setByteOrder(QDataStream::LittleEndian); // The endian type you want
stream.device()->seek(position);
stream << number;


Is there any other option to get this directly to a QByteArray in a platform
independent way?

Thanks,
Francisco González
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100907/5f489d57/attachment.html 


More information about the Qt-interest-old mailing list