XbZ_Compress()
|
Previous Top Next |
XbZ_Compress(@cData,
|
[@nError]) --> cCompressed
|
<@cData>
|
<@cData> contains a string that should be compressed (with the Deflate method). This parameter must be passed by reference, even though it will not be modified.
|
<@nError>
|
After XbZ_Compress() returns, the optional Parameter <@nError> will contain any kind of Compression Error that might be raised by the ZLib compress() function. This parameter is optional, but must be passed by reference if it should be updated.
|
|
Possible values are the following Define Constants from the XbZLib.ch file:
|
|
|
This function returns a Deflated (compressed) version of <@cData> or possibly a string that only contains spaces, if an error occurred.
|
This is basically an Xbase++ Wrapper Function for the ZLib Function: compress(). It returns the compressed (deflated) <@cData> as a string, and updates <@nError> with any possible Error Return Code of the ZLib Function. It is virtually identical to the XbZ_Compress2() method, but always uses the Default Compression Level value of XBZ_DEFAULT_COMPRESSION, which cannot be changed.
|
LOCAL nError := XbZ_OK
|
LOCAL cFile := 'XbZLib.chm'
|
LOCAL cData := XbZ_FileRead(cFile, @nError)
|
LOCAL cCompr := ''
|
if nError == XbZ_OK
|
cCompr := XbZ_Compress(@cData, @nError)
|
if nError # XbZ_OK
|
QOut(cFile + ' could not be compressed!')
|
QOut('Error: ' + alltrim(str(nError)))
|
endif
|
else
|
QOut(cFile + ' could not be read!')
|
QOut('Error: ' + alltrim(str(nError)) + ' - ' + ;
|
DosErrorMessage(nError))
|
endif
|