#include <assert.h> #define bounds(_i, _n) (assert( (unsigned) (_i) < (_n) ), (_i) ) .... /* * fout is what we are appending to and should be open rw as necessary. * farray is an array of file pointers, "farsize" is the size of the array. */ void concatenate( FILE *fout, FILE *farray[], const unsigned char *farsize) { int c; unsigned int fi = 1; FILE *fin; /* current segment of farray[] to fout. */ while ( (fi < farsize[0])) { fin = farray[bounds(fi, *farsize)]; fi++; while ( (c = fgetc(fin )) != EOF ) { fputc( c, fout ); } } }
I'm GOING TO BED. 0832 Zulu time on my clock.... must sleeep sleep....
what is that again?
In retrospect, even zonked at that time of night, I do think that is the stupidest bit of code I have ever written in my entire life.
ReplyDelete