Thanks for the reply. Very much appreciated. Mr. Smith's method seems to be 
very neat and I will try to implement that. I needed the count method because a 
virtual List Control that displays the lexicon needs to know number of entries 
in advance.
Right now I am getting the count using a slightly improved brute force:



int GetNumEntries()
{

// initial guess

int high = 10000, low = 0, mid = (high + low)/2;

while ( high - low > 1 ) {

pModule->setPosition(sword::TOP);   pModule->increment(mid);

if( pModule->Error() )     high = mid;

else low = mid;


mid = (high + low)/2; 

}

return high;

}


I am not sure what are the dangers in doing this (if any).


_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to