#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define BFSZ 1000

#define OUTFILE "pile.dat"
FILE *fout;
void add_file(char *afile);
void add_files(char *wild);
char whole[1000000];
main()
{
	FILE *fout;
	FILE *f;
	union {int x; char bf[4];} both;
	char bf[4];
	char afile[1000];
	int len;

	fout = fopen(OUTFILE,"rb");
	if (fout==NULL) {perror(OUTFILE);}
	for (;;) {
		if (fread(afile,1,40,fout)<40) return 0;
		fread(&len,4,1,fout);
		fread(whole,1,len,fout);	
		printf("Writing %s\n",afile);
		f = fopen(afile,"w");
		fwrite(whole,1,len,f);
		fclose(f);
	}
 	fclose(fout);
	return 0;
}
