summaryrefslogtreecommitdiff
path: root/MegamanX5/unarc.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-09-27 12:17:57 +0000
committerPixel <Pixel>2002-09-27 12:17:57 +0000
commitbfa5de7eccf4604ff8217f619e9685a09e80d545 (patch)
treea5be5de750ac611145f459a09bda902c3dbc1a70 /MegamanX5/unarc.cpp
parent60c1003845035ad4cd0e9ea50862bad7626faf0e (diff)
The week-without-the-network changes
Diffstat (limited to 'MegamanX5/unarc.cpp')
-rw-r--r--MegamanX5/unarc.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/MegamanX5/unarc.cpp b/MegamanX5/unarc.cpp
index c9ab2be..38a6522 100644
--- a/MegamanX5/unarc.cpp
+++ b/MegamanX5/unarc.cpp
@@ -1,40 +1,40 @@
#include <stdlib.h>
#include "generic.h"
-#include "fileutils.h"
+#include "Input.h"
+#include "Output.h"
+#include "Main.h"
-int main(int argc, char ** argv) {
- FILE * f;
+CODE_BEGINS
+int startup() {
+ Handle * f, * o;
int i = 0;
- f = fopen(argv[1], "r");
+ f = new Input(argv[1]);
int offset = 0;
while (1) {
int sector, size;
- fseek(f, offset, SEEK_SET);
- fread(&sector, 4, 1, f);
- fread(&size, 4, 1, f);
+ f->seek(offset, SEEK_SET);
+ f->read(&sector, 4);
+ f->read(&size, 4);
offset += 8;
if (!sector)
break;
- fseek(f, sector <<= 9, SEEK_SET);
+ f->seek(sector <<= 9, SEEK_SET);
- char * buffer = (char *) malloc(size);
-
- fread(buffer, 1, size, f);
-
- char fname[64];
- sprintf(fname, "unarc-%03i.out", i);
- FILE * o = fopen(fname, "w");
- fwrite(buffer, 1, size, o);
- fclose(o);
+ String fname;
+ fname.set("unarc-%03i.out", i);
+ o = new Output(fname);
+ copy(f, o, size);
+ delete o;
i++;
-
- free(buffer);
}
- exit(-1);
+ delete f;
+
+ return -1;
}
+CODE_ENDS