Making and sending a mix double and int array in c -


i trying send msg socket in form on

double,int,int,int,int,...,int 

n int values how can send it? have opened socket how can put elements in 1 array sent in:

status=sendto(sendsocket,msg,sizeof(double)+n*sizeof(int), 0,(void*)&out_socketaddr,sizeof(out_socketaddr)); 

where msg memory(array) of elements , out_socketaddr destination

uint8_t array [sizeof(this) + sizeof(that) + ...]; uint8_t* ptr = array;  memcpy(ptr, &this, sizeof(this)); ptr+=sizeof(this); memcpy(ptr, &that, sizeof(that)); ptr+=sizeof(that); ... 

avoid making struct. although structs make code more readable, introduce padding, issue in case.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -