How to split and join array in C++?
Posted
by
Richard Knop
on Stack Overflow
See other posts from Stack Overflow
or by Richard Knop
Published on 2010-12-28T20:51:08Z
Indexed on
2010/12/28
20:54 UTC
Read the original article
Hit count: 174
c++
I have a byte array like this:
lzo_bytep out; // my byte array
size_t uncompressedImageSize = 921600;
out = (lzo_bytep) malloc((uncompressedImageSize + uncompressedImageSize / 16 + 64 + 3));
wrkmem = (lzo_voidp) malloc(LZO1X_1_MEM_COMPRESS);
// Now the byte array has 802270 bytes
r = lzo1x_1_compress(imageData, uncompressedImageSize, out, &out_len, wrkmem);
How can I split it into smaller parts under 65,535 bytes (the byte array is one large packet which I want to sent over UDP which has upper limit 65,535 bytes) and then join those small chunks back into a continuous array?
© Stack Overflow or respective owner