CreatePack()

Syntax

Result = CreatePack(#Pack, Filename$ [, Plugin [, Level]])
Description
Create a new empty pack file. If the file already exists, it will be replaced with a new empty file. Before creating a pack file, at least one packer has to be registered with one of the following command: UseZipPacker(), UseBriefLZPacker().

Parameters

#Pack A number to identify the new pack file. #PB_Any can be used as a parameter to auto-generate this number.
Filename$ The filename for the new pack file.
Plugin (optional) The plugin to use, if more than one packer plugin has been registered. It can be one of the following value:
  #PB_PackerPlugin_BriefLZ: use the BriefLZ packer to create the pack file. UseBriefLZPacker() has to be called to register the plugin.
  #PB_PackerPlugin_Zip    : use the Zip packer to create the pack file. UseZipPacker() has to be called to register the plugin.
  #PB_PackerPlugin_Lzma   : use the Lzma packer to create the pack file (also known as 7z archive). UseLZMAPacker() has to be called to register the plugin.
  #PB_PackerPlugin_Tar    : use the Tar packer to create the pack file. UseTarPacker() has to be called to register the plugin.
                             It can be combined with #PB_Packer_Gzip or #PB_Packer_Bzip2 to create compressed tar archive.
Level (optional) The compression level to use. It is an integer value ranging from 0 (lower compression ratio, faster compression) to 9 (higher compression ratio, slower compression).

Return value

Returns nonzero if the pack file has been successfully created, zero otherwise. If #PB_Any was used as the #Pack parameter then the generated pack number is returned.
  UseZipPacker()

  ; Create the packed file
  If CreatePack(0, "mycompressedfiles.zip") 
  
    ; add your files 
    AddPackFile(0, "Image1.bmp", "Image1.bmp")  
    AddPackFile(0, "Image2.bmp", "Image2.bmp") 
    AddPackFile(0, "mywave1.wav", "mywave1.wav") 
    AddPackFile(0, "mywave2.wav", "mywave2.wav") 
    ClosePack(0) 
  EndIf

See Also

ClosePack()

Supported OS

All

<- CompressMemory() - Packer Index - ExaminePack() ->