+void handlebinary(TAG*tag) {
+ FILE *fout = NULL;
+ char buf[100];
+ char *filename = buf;
+ int len = tag->memsize;
+ int dx = 6; // offset to binary data
+ if (tag->id!=ST_DEFINEBINARY) {
+ fprintf(stderr, "Object %d is not a binary entity!\n",
+ GET16(tag->data));
+ return;
+ }
+ sprintf(buf, "binary%d.bin", GET16(tag->data));
+ if(numextracts==1) {
+ filename = destfilename;
+ if(!strcmp(filename,"output.swf")) {
+ sprintf(buf, "output.bin");
+ filename = buf;
+ }
+ }
+ fout = fopen(filename, "wb");
+ fwrite(tag->data+dx,len-dx,1,fout);
+ fclose(fout);
+}
+