Subject:
|
problem with lnpd...help!?
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 15 Mar 2002 18:37:09 GMT
|
Viewed:
|
2015 times
|
| |
| |
hi all. im using legOS 0.2.4 and using lnpd to communicate with my linux box.
now then, here is my problem.
lets imagine i have the following:
foo{
int test;
char *test2;
void *test3;
};
char *test4 = 'a';
char *test5 = 'b';
struct foo bar* = NULL;
bar = (struct foo*)malloc(sizeof(foo));
bar->test = 1;
bar->test2 = test4;
bar->test3 = test5;
Now,i want to send bar, using lnpd to my linux box, but my problem is that
lnp_addressing_write only uses a pointer to a memory location
as well as the size to send.
but i have no idea where the pointers in my bar structs are actually pointing as well
as where my test4 and test5 variables are.
somehow i need to store the values in my bar struct in sequence, in order to send
the message.
but, im not quite sure how to do this
any/all feedback appriciated :)
regards
kenneth johansen
|
|
Message has 3 Replies: | | Re: problem with lnpd...help!?
|
| (...) That's wrong. You should write "char test4 = 'a';", otherwise you are implicitly casting the character 'a' to a pointer to store it in test4 (the compiler should warn you about this; use -Wall to catch these errors). (...) Then this line (...) (23 years ago, 15-Mar-02, to lugnet.robotics.rcx.legos)
| | | Re: problem with lnpd...help!?
|
| This is really more of a general C question than an lnpd question. Anyway, the problem is with serialization; you want to take a structure in memory, and turn it into a stream of bytes, either to store in a file, send over a network, or whatever. (...) (23 years ago, 15-Mar-02, to lugnet.robotics.rcx.legos)
| | | Re: problem with lnpd...help!?
|
| (...) this must be char test4 = 'a'; I think. Otherwise, you won't sent an 'a' anyway. But I can't imaginge why you want to do this. Michael Ash has shown a way to fiddle the strings into a contigous data area ready to be sent. But why do you want (...) (23 years ago, 15-Mar-02, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
11 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|