D
dogwasstar
I am new at programming ruby with C. I am trying to pass in a value from
a test ruby program to my C class and trying to print it out. But when i
print it out i am getting the wrong number printerd out.
Here is what i am trying to do.
Here is the ruby test file
class TestTest < Test::Unit::TestCase
def test_test
k = PKey.new('4')
assert_equal(Object, PKey.superclass)
assert_equal(PKey, k.class)
trtying = k.bit(5)
end
end
Here is the C file
static VALUE t_bit(VALUE self, VALUE obj)
{
VALUE n;
n = NUM2INT(obj);
printf("Fun %d", INT2NUM(n));
return Qnil;
}
Any suggestion would be helpfull. Thanks
a test ruby program to my C class and trying to print it out. But when i
print it out i am getting the wrong number printerd out.
Here is what i am trying to do.
Here is the ruby test file
class TestTest < Test::Unit::TestCase
def test_test
k = PKey.new('4')
assert_equal(Object, PKey.superclass)
assert_equal(PKey, k.class)
trtying = k.bit(5)
end
end
Here is the C file
static VALUE t_bit(VALUE self, VALUE obj)
{
VALUE n;
n = NUM2INT(obj);
printf("Fun %d", INT2NUM(n));
return Qnil;
}
Any suggestion would be helpfull. Thanks