http://www.ruby-doc.org/doxygen/1.8.4/st_8c.html
Is there some tutorials or examples about it?thanks
gz zz wrote:
http://www.ruby-doc.org/doxygen/1.8.4/st_8c.html
Is there some tutorials or examples about it?thanks
hash.c in the ruby source might help. Also, the Ruby Hacking Guide has
some info:
Joel VanderWerf wrote:
gz zz wrote:
http://www.ruby-doc.org/doxygen/1.8.4/st_8c.html
Is there some tutorials or examples about it?thankshash.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;
}