I have this sample code:
quint32 tag;
tag = 0x00;
newDataSrteam
->setByteOrder
(QDataStream::LittleEndian);
int i = 0;
while(i++<10)
{
ba.clear();
*newDataSrteam << (quint32)tag++;
printf("%s\n", ba.toHex().data());
}
QDataStream *newDataSrteam;
QByteArray ba;
quint32 tag;
tag = 0x00;
newDataSrteam = new QDataStream(&ba, QIODevice::WriteOnly | QIODevice::Unbuffered);
newDataSrteam->setByteOrder(QDataStream::LittleEndian);
int i = 0;
while(i++<10)
{
ba.clear();
*newDataSrteam << (quint32)tag++;
printf("%s\n", ba.toHex().data());
}
To copy to clipboard, switch view to plain text mode
and running I get the following output:
00000000
0000000001000000
303030303030303002000000
30303030303030300200000003000000
3030303030303030020000000300000004000000
303030303030303002000000030000000400000005000000
33303330333033303330333033303330303230303030303006000000
3330333033303330333033303330333030323030303030300600000007000000
333033303330333033303330333033303032303030303030060000000700000008000000
33303330333033303330333033303330303230303030303006000000070000000800000009000000
00000000
0000000001000000
303030303030303002000000
30303030303030300200000003000000
3030303030303030020000000300000004000000
303030303030303002000000030000000400000005000000
33303330333033303330333033303330303230303030303006000000
3330333033303330333033303330333030323030303030300600000007000000
333033303330333033303330333033303032303030303030060000000700000008000000
33303330333033303330333033303330303230303030303006000000070000000800000009000000
To copy to clipboard, switch view to plain text mode
I wonder what is wrong with my code...
what is happening? It seem that be is never cleared...
thanks
Bookmarks