Originally Posted by
tanderson
this seems to be working:
//setup
QVector<qint16> inVect;
inVect << 0 << 3 << 0 << 16384 << -7460;
storageIn.writeRawData((const char*)inVect.data(), 10);
//read back
QVector<qint16> outVect;
outVect.resize(5);
storageOut.readRawData((char*)outVect.data(), 10);
foreach (qint16 current, outVect)
qDebug() << current;
//setup
QVector<qint16> inVect;
inVect << 0 << 3 << 0 << 16384 << -7460;
QByteArray storage;
QDataStream storageIn(&storage, QIODevice::WriteOnly);
storageIn.writeRawData((const char*)inVect.data(), 10);
//read back
QDataStream storageOut(&storage, QIODevice::ReadOnly);
QVector<qint16> outVect;
outVect.resize(5);
storageOut.readRawData((char*)outVect.data(), 10);
foreach (qint16 current, outVect)
qDebug() << current;
To copy to clipboard, switch view to plain text mode
output is:
Starting .../QtConsoleTest...
0
3
0
16384
-7460
.../QtConsoleTest exited with code 0
You can try this:
QVector<qint16> inVect;
inVect << 0 << 3 << 0 << 16384 << -7460;
qDebug()<<QByteArray((const char*)inVect.data(), 10).toHex();
inVect.clear();
inVect << 0 << 768 << 0 << 64 << -8990;
qDebug()<<QByteArray((const char*)inVect.data(), 10).toHex();
QVector<qint16> inVect;
inVect << 0 << 3 << 0 << 16384 << -7460;
qDebug()<<QByteArray((const char*)inVect.data(), 10).toHex();
inVect.clear();
inVect << 0 << 768 << 0 << 64 << -8990;
qDebug()<<QByteArray((const char*)inVect.data(), 10).toHex();
To copy to clipboard, switch view to plain text mode
output:
"0000030000000040dce2"
"0000000300004000e2dc"
"0000030000000040dce2"
"0000000300004000e2dc"
To copy to clipboard, switch view to plain text mode
Bookmarks