Hi to all,
(wysota sorry in advance if my question is trivial ).
I would know why these 2 piece of code give different result:
QByteArray ba
= m_axobj
->dynamicCall
("GetUserData(QString)", id
).
toByteArray();
quint16 templatesize = 0;
memcpy( &templatesize, &ba[87], sizeof(quint16) );
templatesize = qFromBigEndian(templatesize);
qDebug() << templatesize;
QByteArray ba = m_axobj->dynamicCall("GetUserData(QString)", id ).toByteArray();
quint16 templatesize = 0;
memcpy( &templatesize, &ba[87], sizeof(quint16) );
templatesize = qFromBigEndian(templatesize);
qDebug() << templatesize;
To copy to clipboard, switch view to plain text mode
And
QByteArray ba
= m_axobj
->dynamicCall
("GetUserData(QString)", id
).
toByteArray();
const char *dat = ba.constData();
quint16 templatesize = 0;
memcpy( &templatesize, dat+87, sizeof(quint16) );
templatesize = qFromBigEndian(templatesize);
qDebug() << templatesize;
QByteArray ba = m_axobj->dynamicCall("GetUserData(QString)", id ).toByteArray();
const char *dat = ba.constData();
quint16 templatesize = 0;
memcpy( &templatesize, dat+87, sizeof(quint16) );
templatesize = qFromBigEndian(templatesize);
qDebug() << templatesize;
To copy to clipboard, switch view to plain text mode
Reading QByteArray documentation the [i] operator should return the byte at position i so with the & operator I get its address.
This should be the same of adding the offset i at the first value address.
I'm sure I'm wrong but where?
Bookmarks