Class: FFI::StructLayout::CharArray

Inherits:
Object
  • Object
show all
Defined in:
lib/nwrfc/nwrfclib.rb

Overview

Enhancement to FFI::StructLayout::CharArray to add a get_str method that changes the string value of the character array by enforcing encoding of UTF-16LE (as used in NW RFC SDK) and strips off blanks at the end to return a readable String

Instance Method Summary collapse

Instance Method Details

#get_strObject



68
69
70
71
# File 'lib/nwrfc/nwrfclib.rb', line 68

def get_str
  #Iconv.conv("UTF8", "UTF-16LE", self.to_ptr.read_string(self.size)).strip
  NWRFCLib::Cutf16le_to_utf8.iconv(self.to_ptr.read_string(self.size)).strip
end