libmpq(3)

NAME
libmpq - cross-platform C library for manipulating mpq archives.

SYNOPSIS
#include <mpq.h>

int32_t libmpq__block_read(
        mpq_archive_s  *mpq_archive,
        uint32_t        file_number,
        uint32_t        block_number,
        uint8_t        *out_buf,
        off_t           out_size,
        off_t           transferred
);

DESCRIPTION

Call libmpq__block_read() to read a given block into memory. If the block is encrypted it will be first decrypted and then if it is packed (compressed or imploded) it will be unpacked.

The libmpq__block_read() function takes as first argument the archive structure mpq_archive which have to be allocated first and opened by libmpq__archive_open(). The second argument file_number is the number of file, the third argument block_number is the number of block. The fourth argument out_buf is the output data buffer which contains the extracted data and the fifth argument out_size is the size of out_buf. The sixth argument is a reference to the transferred bytes of the file.

RETURN VALUE
On success, a zero is returned and on error one of the following constants.

LIBMPQ_ERROR_EXIST
    Block does not exist in archive.

LIBMPQ_ERROR_OPEN
    Block offset table was not opened by calling libmpq__block_open_offset(), or it was closed by an libmpq__block_close_offset() call.

LIBMPQ_ERROR_SIZE
    The output buffer is to small.

LIBMPQ_ERROR_SEEK
    Seeking in file failed.

LIBMPQ_ERROR_MALLOC
    Not enough memory for creating required structures.

LIBMPQ_ERROR_READ
    Reading in archive failed.

LIBMPQ_ERROR_DECRYPT
    Decrypting block failed.

LIBMPQ_ERROR_UNPACK
    Unpacking block failed.

SEE ALSO
libmpq__file_read(3)

AUTHOR
Check documentation.

libmpq is (c) 2003-2011
    Maik Broemme <mbroemme@libmpq.org>

The above e-mail address can be used to send bug reports, feedbacks or library enhancements.