Method: FFI::Pointer#read_string
- Defined in:
- lib/ffi/pointer.rb
#read_string(len = nil) ⇒ String
Read pointer’s contents as a string, or the first len
bytes of the equivalent string if len
is not nil
.
57 58 59 60 61 62 63 64 |
# File 'lib/ffi/pointer.rb', line 57 def read_string(len=nil) if len return ''.b if len == 0 get_bytes(0, len) else get_string(0) end end |