server/dep/libmpq/doc/man3/libmpq__file_read.3
Lynx3d f3f8e5f812 [10162] Added libmpq to dep/
This is from official repo (SVN rev. 300)

Additionally includes free implementation of stdint.h and dirent.h for VC++,
aswell as Visual Studio project files.

Special thanks to faramir118 for Windows support.
2010-07-08 23:05:15 +02:00

77 lines
3 KiB
Groff

.\" Copyright (c) 2003-2008 Maik Broemme <mbroemme@plusserver.de>
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.TH libmpq 3 2008-05-16 "The MoPaQ archive library"
.SH NAME
libmpq \- cross-platform C library for manipulating mpq archives.
.SH SYNOPSIS
.nf
.B
#include <mpq.h>
.sp
.BI "int32_t libmpq__file_read("
.BI " mpq_archive_s *" "mpq_archive",
.BI " uint32_t " "file_number",
.BI " uint8_t *" "out_buf",
.BI " off_t " "out_size",
.BI " off_t *" "transferred"
.BI ");"
.fi
.SH DESCRIPTION
.PP
Call \fBlibmpq__file_read\fP() 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.
.LP
The \fBlibmpq__file_read\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the file to extract, the third argument \fIout_buf\fP is the output data buffer which contains the extracted data. The fourth argument \fIout_size\fP is the size of \fIout_buf\fP and the fifth argument is a reference to the \fItransferred\fP bytes of the file.
.SH RETURN VALUE
On success, a zero is returned and on error one of the following constants.
.TP
.B LIBMPQ_ERROR_EXIST
File does not exist in archive.
.TP
.B LIBMPQ_ERROR_OPEN
Block offset table was not opened by calling \fBlibmpq__block_open_offset\fP(), or it was closed by an \fBlibmpq__block_close_offset\fP() call.
.TP
.B LIBMPQ_ERROR_SIZE
The output buffer is to small.
.TP
.B LIBMPQ_ERROR_SEEK
Seeking in file failed.
.TP
.B LIBMPQ_ERROR_MALLOC
Not enough memory for creating required structures.
.TP
.B LIBMPQ_ERROR_READ
Reading in archive failed.
.TP
.B LIBMPQ_ERROR_DECRYPT
Decrypting file failed.
.TP
.B LIBMPQ_ERROR_UNPACK
Unpacking file failed.
.SH SEE ALSO
.BR libmpq__block_read (3)
.SH AUTHOR
Check documentation.
.TP
libmpq is (c) 2003-2008
.B Maik Broemme <mbroemme@plusserver.de>
.PP
The above e-mail address can be used to send bug reports, feedbacks or library enhancements.