libmpq(3)

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

SYNOPSIS
#include <mpq.h>

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

DESCRIPTION

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

The libmpq__file_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 file to extract, the third argument out_buf is the output data buffer which contains the extracted data. The fourth argument out_size is the size of out_buf and the fifth 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
    File 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 file failed.

LIBMPQ_ERROR_UNPACK
    Unpacking file failed.

SEE ALSO
libmpq__block_read(3)

AUTHOR
Check documentation.

libmpq is (c) 2003-2008
    Maik Broemme <mbroemme@plusserver.de>

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