Instantly share code, notes, and snippets.

Embed
What would you like to do?
void somefunc(rax *mytree) {
raxIterator iter;
raxStart(&iter,mytree);
/* As seek operator you can use >, <, >=, <=, == */
raxSeek(&iter,(unsigned char*)"chromo",6,"<="); /* Seek key <= "chromo" */
while(raxNext(&iter,NULL,0,NULL)) { /* or raxPrev() */
printf("Current key: %.*s, val %p\n",
(int)iter.key_len, (char*)iter.key, iter.data);
}
/* ... More complex example ... */
raxSeek(&iter,(unsigned char*)"foo",3,">"); /* Seek key > "foo" */
while(raxNext(&iter,"zap",3,"<=")) { /* Return elements up to "zap" */
printf("Current key: %.*s, val %p\n",
(int)iter.key_len, (char*)iter.key, iter.data);
}
raxStop(&iter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment