printing the array values in c

S

saladin.mundi

hey.

how is it possible to print out an array (T_ARRAY) in a C-method?

example

I want to get the instance methods via the corresponding c method. the =
method returns T_ARRAY.
VALUE es =3D rb_class_instance_methods(1, args, CLASS_OF(targetcl));

is there something like:=20
for(int i =3D 0; i<RARRAY_LEN(es); i++)
{
printf("content of array element %s",es);=20
}
?? :)
I know that the content of the array element is a (ruby) string.

thx for your help in advance
 
T

Tim Hunter

unknown said:
hey.

how is it possible to print out an array (T_ARRAY) in a C-method?

example

I want to get the instance methods via the corresponding c method. the
method returns T_ARRAY.
VALUE es = rb_class_instance_methods(1, args, CLASS_OF(targetcl));

is there something like:
for(int i = 0; i<RARRAY_LEN(es); i++)
{
printf("content of array element %s",es);
}
?? :)
I know that the content of the array element is a (ruby) string.

thx for your help in advance


rb_ary_entry(n) returns the VALUE at index n.
StringValuePtr(obj) returns a pointer to the C string in a String
object.
 

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

No members online now.

Forum statistics

Threads
474,270
Messages
2,571,353
Members
48,038
Latest member
HunterDela

Latest Threads

Top