Well ... it's an array of bytes of arbitrary binary content...
funny thing the compiler is perfectly happy with QDataStream >> QByteArray...
Why does it fail the call is still beyond me... (and this is exactly the kind of thing that gets you stuck for hours on end
)
To be honest, and never forgetting my place (newbie), I'd call this one a bug on QT4.
This call should fetch myQByteArray.size bytes from the stream, regardless of content.
Reading the docs for QByteArray it's stated "QByteArray can be used to store both raw bytes..." so it shouldn't matter what kind of content, or where it came from, one puts in it...
Bottom line: is there no other (optimized) way than being stuck with this?
qint8 c;
for (int i = 0; i < sPacket.size_app_payload; i++) {
records >> c;
sPacket.app_payload[i] = c;
}
qint8 c;
for (int i = 0; i < sPacket.size_app_payload; i++) {
records >> c;
sPacket.app_payload[i] = c;
}
To copy to clipboard, switch view to plain text mode
Regarding my other difficulty ...
I want to extract the first two bytes from it to a quint16
Could you please show me a way?
TIA,
Pedro.
Bookmarks