To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2360
2359  |  2361
Subject: 
problem with lnpd...help!?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 15 Mar 2002 18:37:09 GMT
Viewed: 
1894 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:
  Re: where to buy individual parts?
 
One more thing, this is why I am going to move to USA from Japan because I can buy LEGO in cheapest price and fast way, then I can have a big place to test my RCX Controlled LEGO Train Projects, some of them need over 5m x 5m, I have no way to debug (...) (23 years ago, 30-Nov-01, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)

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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR