spamblock / danisch.de wrote:

> Hi,
> 
> I'd like to write a ruby method in C, which passes an
> arbitrary byte string as a result back to ruby.
> 
> All functions I found (like rb_str_new2 ) use
> just a pointer and assume the string to be 0-terminated.
> 
> Any way to convert a buffer into a ruby string based
> on pointer and length?
I don't think rb_str_new() expects a null terminator:

VALUE rb_str_new _((const char*, long));

-- Richard