Subject:
|
Re: problem with lnpd...help!?
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 15 Mar 2002 19:42:16 GMT
|
Viewed:
|
1952 times
|
| |
| |
> char *test4 = 'a';
> char *test5 = 'b';
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).
> bar->test2 = test4;
Then this line becomes "bar->test2 = &test4;"
> somehow i need to store the values in my bar struct in sequence, in order
> to send the message.
Yes. If you don't really need pointers, don't use them and declare
struct foo{
int test;
char test2;
...
};
If you need to store pointers in foo, just write a function wich builds a
temporary structure without pointers and send that one.
Also, be careful; size of int on the rcx is 16 bits while on a pc it's 32
bits and the fields of a structure could be aligned on word boundaries for
efficiency. With gcc, structures can be packed using
struct foo {...} __attribute__((packed));
Eric
--
email: eric.swalens@easynet.be
web: http://student.ulb.ac.be/~eswalens
icq: 2686881
|
|
Message is in Reply To:
| | problem with lnpd...help!?
|
| 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; (...) (23 years ago, 15-Mar-02, to lugnet.robotics.rcx.legos)
|
11 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|