Printing the array values in c

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]);
}
?? :slight_smile:
I know that the content of the array element is a (ruby) string.

thx for your help in advance

unknown wrote:

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]);
}
?? :slight_smile:
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.

···

--
Posted via http://www.ruby-forum.com/\.