Pages: [1]   Go Down
Author Topic: Bridge.get for values with variable length  (Read 226 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear Friends,

I'm using the bridge library to share data between the arduino and the Linux processor, in the following way:

char c[1];
Bridge.get("item", c, 1);

That works very well, but now I need to share an item, wich can be variable in length (an integer, for example 234, 5678, 1, 44444, etc).

How can I retrieve the result if I don't know the length of the value?

Thanks in advance
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46107
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How can I retrieve the result if I don't know the length of the value?
Either use a value that you know is large enough (16 is plenty for any int value) or use two calls - one to get the length and another to get the value.
Logged

Pages: [1]   Go Up
Jump to: