Hi everyone, i have the following problem:
I have a struct which is declared as:
and i have a function,in which i would like to do something like this:Code:typedef struct { unsigned char src[6], dst[6]; unsigned short type; } eth_hdr;
The 'eth_in' is not the same size as the other array, its a lot bigger, but i need to copy the first 6 elements of the array to the 'src' array.Code:void ethernet_decap(unsigned char *eth_in, eth_hdr *hdr) { hdr -> src = eth_in; }
I know its wrong, but you can see what i would like to point at.
And without using strcpy or giving values to that array by a 'for' cicle or something..I want to solve it by pointers and casting. Is that possible somehow?
Thanx