c 数据拼接
char buf1[] = {0x31,0x32,0x33,0x00,0x51,0x52,0x53,0xaa,0xbb,0xcc,0x00}; int a=0xabcd6799; int b=0x88991122; int d=0x12345678; int c=sizeof(int)*3+sizeof(buf1); printf("%d\n",c); char *buf2=malloc(c); char *buf3=buf2; memcpy(buf2,&a,sizeof(int)); buf2+=sizeof(int); memcpy(buf2,&b,sizeof(int)); buf2+=sizeof(int); memcpy(buf2,buf1,sizeof(buf1)); buf2+=sizeof(buf1); memcpy(buf2,&d,sizeof(int)); int i=0; for(;i<c;i++){ printf("0X%02X ",buf3[i]); } printf("\n");