there: I have declaration like this:
typedef struct
{
quint8 mark1;
quint16 content1;
quint16 content2;
quint8 mark2;
}FrameHead;
and in function,I defined a buffer,and valued it:
quint8 buf[40];
FrameHead *frame = (FrameHead *)buf;
frame->mark1 = 0x68;
frame->content1 = 0x3A;
frame->content1 = 0x3A;
frame->mark2 = 0x68;
So as I thought, the first 6 bytes of buf should be "68 3A 00 3A 00 68".But the fact is, the first 8 bytes of buf were "68 90 3A 00 3A 00 68 80".And I used:
qDebug() << (quint8 *)(++frame) - buf// output "8" but should be "6"
seemingly the numbers "0x68" were not stored as quint8 type but quint16 type to keep consistency with other quint16 types.Anyone has encounted the same problems and has any suggestions.