diff options
author | pixel <pixel> | 2007-07-10 09:17:51 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-07-10 09:17:51 +0000 |
commit | 8feb553794efc2a328f8ce2beed5eeacc43238f4 (patch) | |
tree | e1e210e854290078586ea88763b9751a8d6d08a9 /test-it.c | |
parent | e3be7db2c856dc67286a5c873f65af1f40126f46 (diff) |
mpq-file working.
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; |