Hi,
I got a QByteArray called mBuffer, and I want to put 4 Integers in it.
I did this with the append function of QByteArray.
But if I for Example put these values (2,42,7,9224) in it, in my Buffer stays 24279224.
But I want that 00'00'00'02'00'00'00'2A'00'00'00'07'00'00'24'08 are in my Buffer.
00'00'00'02 for 2
00'00'00'2A for 42
00'00'00'07 for 7
00'00'24'08 for 9224
Those 00 stand for each Byte, and I got 4 for each Integer.
I think oneway would be to use memcpy, but for this I have to convert my Integer in Char[4] array, and then memcpy it to the Buffer. But I hope there is a more proper Solution.
Bookmarks