First a new iterator is created. Then for myCount iterations, the iterator accesses the next key-value pair. If the count is 0 (the first element) then retrieve the first pair. For all other counts retrieve the next pair.
NOTE
Key-value pairs are sometimes referred to as associations..
// example using TDiskDictionaryIterator
TDiskDictionaryIterator* myIterator = new TDiskDictionaryIterator(dict);
for (i=0; i=myCount; i++ ) {
if (i==0)
myAssoc = myIterator->First();
else
myAssoc = myIterator->Next();
if (myAssoc)
delete myAssoc;
else
{
qprintf("No Assoc exists for i = %d ",i);
if (i == myCount)
qprintf("This is expected.\n");
else
qprintf("This is NOT expected!\n");
break;
}
}
delete myIterator;