Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Open file handle.

...

Code Block
titleXFRX 22.0
Object.OpenNewFile(tcFileName [, ttCreated [, llIWontUTF8 
                   [, lcPassword, liCRC32 [, llBIGFile [, lcComment]]]]])


Code Block
titleXFRX 22.1
Object.OpenNewFile(tcFileName [, ttCreated [, llIWontUTF8 
                   [, lcPassword, liCRC32 [, llBIGFile
                   [, liLevel [, liMemLevel [, liStrategy [, liWBITS]]]]]]]])

Parameters

tcFileName

   File name in ZIP archive. Default codepage is ANSI. If value of tcFileName of llIWontUTF8 parameter is TRUE, then string will be convert to  UTF-8. 

...

 File comment. Default codepage is ANSI. If value of llIWontUTF8 parameter is TRUE, then string will be convert to  UTF-8.

liLevel

 Compression level. Allowed values are 1-9.

liMemLevel

 Memory level specifies how much memory should be allocated.

liStrategy

 Strategy specifies the compression algorithm. Allowed values are:

ValueDescription
0Default strategy
1Filtered data
2Huffman encoding
3RLE
4Fixed

liWBITS

 Specifies dictionar size in bits. Allowed values are 9..15.

Return values

Number

ValueDescription
0File append to ZIP archive
-102Bad paremeters. (ZIP_PARAMERROR)
-103File is not a zip file. (ZIP_BADZIPFILE)
-104Internal at error at zipping data. (ZIP_INTERNALERROR)

...

Code Block
LOCAL m.loZIP, m.lcZIPFile, m.lcFile
m.lcZIPFile="c:\temp\_big.zip"
m.loZIP =  EVALUATE([xfrx("XFRX#ZIP")])  
IF m.loZip.openArchive(m.lcZIPFile)

   m.lcData=SYS(0)+" "+TTOC(DATETIME())
   m.loZip.OpenNewFile("myFile") 
   m.loZip.WriteData(m.lcData) 
   m.loZip.CloseFile() 

   m.lcData=SYS(0)+" "+TTOC(DATETIME())
   m.loZip.OpenNewFile("myFile+Datetime", {^2022-01-01}) 
   m.loZip.WriteData(m.lcData) 
   m.loZip.CloseFile() 

   m.lcData=SYS(0)+" "+TTOC(DATETIME())
   m.loZip.OpenNewFile("myFile+Datetime+National+Characters - "+"bílý žluťoučký kůň", {^2022-01-01}, .T.) 
   m.loZip.WriteData(m.lcData) 
   m.loZip.CloseFile() 

   m.lcData=SYS(0)+" "+TTOC(DATETIME())
   m.loZip.OpenNewFile("myFile+Datetime+ěščřž+password", {^2022-01-01}, .T., "mypwd", loZIP.SYS2007(m.lcData))

   m.loZip.WriteData(m.lcData) 
   m.loZip.CloseFile() 

   m.lcData=SYS(0)+" "+TTOC(DATETIME())
   m.loZip.OpenNewFile("myFile+Datetime+ěščřž+password+file comment", {^2022-01-01}, .T., "mypwd", loZIP.SYS2007(m.lcData), .F., "my file comment") 
   m.loZip.WriteData(m.lcData) 
   m.loZip.CloseFile() 
   
   m.loZip.closearchive("ěščřžýáíé")
ENDIF
RELE m.loZIP 

...