主要的功能就是给sendbuf赋值
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
typedef struct
{
int longitude;
int latitude;
char sign;
char mode;
}date;
int main(int argc,const char* argv[])
{
date *cmddate9;
cmddate9=(date *)malloc(sizeof(cmddate9));
memset(cmddate9,0,sizeof(cmddate9));
int *longitude = NULL;
unsigned char sendbuf1[8]={0};
cmddate9->longitude=9;
printf("%d\n",cmddate9->longitude);
longitude =(int*)&sendbuf1[5];
*longitude= cmddate9->longitude;
printf("%d\n",sendbuf1[5]);
return 0;
}