Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Fiddle::Pointer#to_str

to_str(len = nil)
Example
ptr.to_str        => string
ptr.to_str(len)   => string

Returns the pointer contents as a string.

When called with no arguments, this method will return the contents with the length of this pointer’s size.

When called with len, a string of len bytes will be returned.

See to_s

See also #to_s #to_value #to_ptr also in 3.3 · 3.2 · 3.1 · 3.0