jointing data from pointers to one

g'day,
Could anybody help me with joinning data?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
struct data {
    union {
        struct {
            u_int16_t match_size;
            char name[512];
            u_int8_t revision;
        } user;
        u_int16_t match_size;
    } u;
    unsigned char 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?

}
What are you tying to do? What do you mean by
joining data
?
why don't you just try append
p = (&p).append(&m);
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
isacbah,
what's that append means?
Ignore that. It doesn't exist. It's not even syntactically correct.

I can't understand what you're saying. Did you solve it yourself or not?
Last edited on
no, itn't work in right way.
if i understood ur problem u want to concatunate two strings.
append is a function in c++ that concatinate two strings and its sintax is like this
 
str3 = str1.append(str2);// the value of str3 is the concatination of str1 and str2 

i thought that will help u
thnx
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
Topic archived. No new replies allowed.