From 8feb553794efc2a328f8ce2beed5eeacc43238f4 Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 10 Jul 2007 09:17:51 +0000 Subject: mpq-file working. --- test-it.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test-it.c') diff --git a/test-it.c b/test-it.c index 5a0b76b..f34d07f 100644 --- a/test-it.c +++ b/test-it.c @@ -1,11 +1,13 @@ #include #include #include "mpq-bios.h" +#include "mpq-file.h" #include "mpq-errors.h" int main(int argc, char ** argv) { struct mpq_archive_t * t1; char * fname = "test.mpq"; + struct mpq_file_t * f1; mpqlib_init(); @@ -21,6 +23,23 @@ int main(int argc, char ** argv) { mpqlib_printtables(t1); + f1 = mpqlib_open_filename(t1, "(listfile)"); + + if (f1) { + int size; + char * b; + printf("Found (listfile), trying to read.\n"); + size = mpqlib_seek(f1, 0, MPQLIB_SEEK_END); + mpqlib_seek(f1, 0, MPQLIB_SEEK_SET); + printf("Filesize seems to be: %d.\n", size); + b = (char *) malloc(size + 1); + b[size] = 0; + mpqlib_read(f1, b, size); + printf("Dumping:\n"); + printf("%s", b); + printf("\nDone.\n"); + } + mpqlib_close_archive(t1); return 0; -- cgit v1.2.3