LZRead

  INT LZRead(hFile, lpBuffer, cbRead)    
  INT hFile; /* handle identifying a file */
  LPSTR lpBuffer; /* pointer to buffer which receives bytes */
  INT cbRead; /* count of bytes */

The LZRead function reads (at most) the number of bytes specified by cbRead from the file identified by hFile into the buffer at which lpBuffer points.

Parameters

hFile

Identifies the source file.

lpBuffer

Points to a buffer which receives the bytes read from the file.

cbRead

Specifies the count of bytes to be read.

Return Value

If the function is successful, the return value specifies the actual number of bytes read; 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 was not valid.
LZERROR_READ The source file format was not valid.
LZERROR_GLOBLOCK The handle identifying required initialization data is invalid.
LZERROR_BADVALUE The cbRead argument specifies a negative value.
LZERROR_UNKNOWNALG The file was compressed with an unrecognized compression algorithm.

Comments

If the file is not compressed, LZRead calls _lread which performs the read operation.

If the file is compressed, LZRead emulates _lread on an expanded image of the file and copies the bytes of data into the buffer at which lpBuffer points.

The LZOpenFile, LZSeek, and LZRead functions may be called instead of the OpenFile, _llseek, and _lread functions if the source file was compressed using the COMPRESS.EXE utility.

See Also

LZOpenFile, LZSeek, LZRead, _llseek, _lread