q***z 发帖数: 934 | 1 Here is my program
the head is
typedef struct struct_CN
{
unsigned char magicA;
unsigned char magicB;
unsigned short msgLen;
} CN;
typedef struct struct_CcDev
{
CN Header;
unsigned short action;
} CcDev;
CcDev CcDev_packet;
Evaluate_CN(CN *CN_p)
{
strcpy(&CN_p->magicA,"A");
printf("magicA is %s\n", &CN_p->magicA);
strcpy(&CN_p->magicB,"H");
printf("magicB is %s\n", &CN_p->magicB);
CN_p->msgLen = 1234;
printf("msgLen is %d\n", &CN_p->msgLen);
}
void | j*****s 发帖数: 16 | 2 shouldn't you change ``unsigned char magicA'' etc. into
``char magicA[2]'' if you treat it as a c-string?
【在 q***z 的大作中提到】 : Here is my program : the head is : typedef struct struct_CN : { : unsigned char magicA; : unsigned char magicB; : unsigned short msgLen; : } CN; : typedef struct struct_CcDev : {
|
|