About
The ZipFile class provides means to work with ZIP archives. ZIP files can be created, modified and extracted.
- Note
- To create ZIP archives with the MAXON API ALIASES see Archives Manual.
Allocation/Deallocation
ZipFile objects are created with the usual tools, see Entity Creation and Destruction Manual (Classic).
Opening and Closing
Filename
Metadata
Compression Level
CRC
Extracting an Entire Archive
Current File
Internally the ZipFile class has a pointer to the "current" file inside of the archive. The following functions provide means to change the current file pointer to another file or directory.
UInt32 fileSizeUncompressed = 0;
return PrintMsgAndCloseZipFile(zf, "Error: No files in ZIP archive.");
do
{
{
sceneFound = true;
break;
}
if (!sceneFound || fileSizeUncompressed == 0)
return PrintMsgAndCloseZipFile(zf, "Error: No C4D scene found in archive.");
The current file can be extracted from a ZIP archive:
if (zf == nullptr)
if (!zf->
Open(fnZip,
true))
{
}
do
{
Comprehensive information can be retrieved for the current file:
Similar to "normal" files (e.g. BaseFile) the current file can be opened for reading:
return PrintMsgAndCloseZipFile(zf, "Error: Failed to open current file in archive.");
if (buffer == nullptr)
return PrintMsgAndCloseZipFile(zf, "Error: Failed to open allocate buffer.");
const Int32 maxChunkSize = 0x1000;
Char* bufferCurrentPos = buffer;
{
if (chunkSize <= 0)
break;
if (numBytesRead < 0)
break;
bufferCurrentPos += numBytesRead;
}
{
return PrintMsgAndCloseZipFile(zf, "Error: Something went wrong, while reading file from archive.");
}
Add to an ZIP File
Further Reading