struct data {
union {
struct {
u_int16_t match_size;
char name[512];
u_int8_t revision;
} user;
u_int16_t match_size;
} u;
unsignedchar data[0];
};
int main{
struct data *p=NULL, *m=NULL;
p = foo();// here i add something to struct struct data
m = oof();// and here too
memcpy(p+sizeof(struct data),m,sizeof(struct data)); // it's not appending data from *m pointer to *p pointer, why? how that make?
}
isacbah,
what's that append means?
kbw,
I tries joining data from few pointers. i.e. I need append data pointed by one pointer to another pointed area and again it with second pointed area so as to fill temporary pointed area.
what so I did... http://codepad.org/4WcUkpA5
it comes from iptables project, libiptc usage, I can add rules like
ACCEPT tcp -- 11.11.11.11 anywhere tcp spt:888 dpt:999
ACCEPT udp -- 22.22.22.22 anywhere length 0:200
but just can't
ACCEPT udp -- anywhere anywhere length 200 udp spt:888 dpt:999
Are you trying to make some kind of composite object? I'm not sure where this discussion is leading, but you might want to see if this meets your needs: http://en.wikipedia.org/wiki/Composite_pattern