Re: need help on #271678 (sizefo struct?)
Vincent Zweije <vzweije@sense.xs4all.nl> writes:
> If you happen to have a variable (or field or in fact any expression)
> of that type (either type "struct x25_address" or type "x25_address"),
> then you can take the size of the variable, instead of the size of the
> type. So you can do:
> memcpy(&rt.address, &sx25.sx25_addr, sizeof sx25.sx25_addr);
> This will work with either definition of sx25_address.
D'oh, yes, very good point. That's the clearly better way of doing this;
I got too caught up in the wrong approach.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Reply to: