Page 1 of 1

For the Code Savant

Posted: Fri May 05, 2000 6:07 am
by Allen M.
<font color=blue>Another dull day. </font>

Image
Sometimes it takes eight hours or more to dream-up and develop the following gem (Sorry George) snippet of [simple] code to serve as a model to enhance and embellish in the process of writing a website. I'm sure the developers who frequent this forum will understand what it takes to write only a few lines of code. The meat of the whole thing is in the while loop, or about 90 minutes per line (must be a slow typist!) to write.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
void CProprietaryDatabase: ImagerocessInternalData()
{
enum { MAXSTRGLEN=123, WORKSTRGLEN=11};//just sumpin' way too big

char sa[MAXSTRGLEN];strcpy(sa,'\0');//three data items. initialized
char sb[MAXSTRGLEN];strcpy(sb,'\0');
char sc[MAXSTRGLEN];strcpy(sc,'\0');
char listCC[WORKSTRGLEN][WORKSTRGLEN];

FILE*fa=fopen(fnameA,"rt");
FILE*fb=fopen(fnameB,"rt");
FILE*fc=fopen(fnameC,"wt");

int c=0;
while(fgets(sa,MAXSTRGLEN,fa)) { //reject list
while(fgets(sb,MAXSTRGLEN,fb)) {//goodstuff list
if(!strcmp(sa,sb)) break;//if identical get another pair
fputs(sb,fc);//save goodstuff
strcpy(listCC[c++],sb);//log saved data for trace debugging
if(strcmp(sa,sb)<0) break;//go for the next goodstuff dataitem
}
}
fclose(fa);
fclose(fb);
fclose(fc);
m=0;
}
</pre><HR></BLOCKQUOTE>

------------------
Allen, Home: http://www.ury2k.com/ mirror: http://home.ici.net/~uechi/

[This message has been edited by Allen M. (edited May 05, 2000).]