How to use st_table by oneself?

G

gz zz

Joel said:
hash.c in the ruby source might help. Also, the Ruby Hacking Guide has
some info:

http://rhg.rubyforge.org/chapter03.html
oh,thank you!
My "hello world" with st_table:

#include <stdio.h>
#include <stdlib.h>
#include "st.c"
int main(int argc, char *argv[])
{
st_table *tbl=st_init_numtable();

st_insert(tbl,1,100);
char *hello = "hello world";
st_insert(tbl,2,(st_data_t)hello);
st_data_t ret;
if(st_lookup(tbl,1,&ret)){
printf("%d\n",ret);
}

if(st_lookup(tbl,2,&ret)){
printf("%s\n",ret);
}

st_free_table(tbl);
system("PAUSE");
return 0;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top