开发者

How to access the data in javascript from the ctype pointer of type uint8_t

开发者 https://www.devze.com 2023-04-02 07:41 出处:网络
I am having some data in ctype uint8_t type pointer which I want to read into the var array in javascript.

I am having some data in ctype uint8_t type pointer which I want to read into the var array in javascript.

I have done simple for loop to copy the data,

for(var j = 0x00; j < 5; j ++) { var dataReceived[j] = ptr[j]; }

but when tried to display data in alert window, it is showing "undefined".

Can anybody help me to copy data from ctype uint8_t pointer to var array?

Is 开发者_运维技巧there any mechanism to copy data?

Vishal N


I've found that [contents] property of a pointer ctypes object can be used to access the object it points to.

try this:

for(var j = 0x00; j < 5; j ++) { 
    var dataReceived[j] = ptr[j].contents; 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号