diff options
Diffstat (limited to 'test-it.c')
-rw-r--r-- | test-it.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1,11 +1,13 @@ #include <stdio.h> #include <stdlib.h> #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; |