C++ zLib compress byte array -
i want compress byte array zlib , here code :
void cggcbotdlg::onbnclickedbuttoncompress() { // todo: add control notification handler code here z_const char hello[] = "hello, hello!"; byte *compr; ulong comprlen; int returncode; ulong length = (ulong)strlen(hello)+1; returncode = compress(compr, &comprlen, (const bytef*)hello, length); } but returncode returns -2 (z_stream_error)
took code directly zlib example codes (example.c), works on own example program , returns 0 (z_ok) there in program returns -2
appreciated
you need allocate compression buffer , send size first 2 params, so:
byte compr[somereasonablesize]; ulong comprlen = sizeof(compr); ...
Comments
Post a Comment