javascript - How to convert a string to TYPES.LPTSTR.targetType.array -


i have supposed definitions follows:

var config = {     is64bit: ctypes.voidptr_t.size == 4 ? false : true,     ifdef_unicode: true}; var types = {     char: ctypes.char,     wchar: ctypes.char16_t}; types.lpstr = types.char.ptr; types.lpwstr = types.wchar.ptr; types.lptstr = config.ifdef_unicode ? types.lpwstr : types.lpstr; 

i have string like: "omnikey ag smart card reader usb 0"

and want convert types.lptstr.targettype.array format in if show tostring() follow:

ctypes.char16_t.array(36)(["o", "m", "n", "i", "k", "e", "y", " ",  "a", "g", " ", "s", "m", "a", "r", "t", " ", "c", "a", "r", "d",  " ", "r", "e", "a", "d", "e", "r", " ", "u", "s", "b", " ", "0",  "\x00", "\x00"]) 

my system 64 bit.

this done this: var st = "omnikey ag smart card reader usb 0"; var st_carr = types.lptstr.targettype.array(st.length+1)(st) did st.length+1 because default gt 1 null terminator, did +1 2 null terminators of \x00


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -