[C++] Wrong EOF when unzipping binary file
- by djzmo
Hello there,
I tried to unzip a binary file to a membuf from a zip archive using Lucian Wischik's Zip Utils:
http://www.wischik.com/lu/programmer/zip_utils.html
http://www.codeproject.com/KB/files/zip_utils.aspx
FindZipItem(hz, filename.c_str(), true, &j, &ze);
char *content = new char[ze.unc_size];
UnzipItem(hz, j, content, ze.unc_size);
delete[] content;
But it didn't unzip the file correctly. It stopped at the first 0x00 of the file.
For example when I unzip an MP3 file, it will only unzip the first 4 bytes: 0x49443303 (ID3\0) because the 5th to 8th byte is 0x00000000.
I also tried to capture the ZR_RESULT, and it always return ZR_OK (which means completed without errors).
I think this guy also had the same problem, but no one replied to his question:
http://www.codeproject.com/KB/files/zip_utils.aspx?msg=2876222#xx2876222xx
Any kind of help would be appreciated :)