Method: Fiddle::Pointer#to_s
- Defined in:
-
ext/fiddle/pointer.c,
lib/fiddle/ffi_backend.rb
Returns the pointer contents as a string.
When called with no arguments, this method will return the contents until the first NULL byte.
When called with len, a string of len bytes will be returned.
See to_str
499 500 501 502 503 504 505 506 507 508 509 |
# File 'ext/fiddle/pointer.c', line 499 def to_s(len = nil) if len ffi_ptr.read_string(len) elsif @size == 0 ffi_ptr.read_string else ffi_ptr.get_string(0, @size) end rescue FFI::NullPointerError raise DLError.new("NULL pointer access") end |