CopyLZFile

  LONG CopyLZFile(hfSource, hfDest)    
  INT hfSource; /* identifies source file */
  INT hfDest; /* identifies destination file */

The CopyLZFile function copies a source file to a destination file. If the source file was compressed, this function creates a decompressed destination file. If the source file was not compressed, this function duplicates the original file.

Parameters

hfSource

Identifies the source file.

hfDest

Identifies the destination file.

Return Value

The return value specifies the size of the destination file in bytes if the function is successful; if an error occurs, the return value is less than zero. The following list identifies possible error return values and their meaning:

Value Meaning

LZERROR_BADINHANDLE The handle identifying the source file, hfSource, was not valid.
LZERROR_BADOUTHANDLE The handle identifying the destination file, hfDest, was not valid.
LZERROR_READ The source file format was not valid.
LZERROR_WRITE There is insufficient space for the output file.
LZERROR_GLOBALLOC There is insufficient memory for the required buffers.
LZERROR_UNKNOWNALG The file was compressed with an unrecognized compression algorithm.

Comments

The CopyLZFile function is designed for copying and/or expanding multiple files. Applications should call LZStart prior to calling CopyLZFile in order to allocate required buffers and call LZDone after copying the files in order to free these buffers.

The file identified by hfDest is always uncompressed.

If the source or destination files are opened using a C-runtime function (rather than _lopen or OpenFile) they must be opened in binary mode.

See Also

_lopen, OpenFile, LZStart, LZDone, LZCopy