chenmo0821 发表于 2013-09-26 09:18

windows向powerpc传送结构体的问题

客户端:
struct ST{
                int a;
                int b;
};
ST st;
st.a = 0xe1;
st.b = 90;

char *tmp = (char*)&st;

tcp的write函数将tmp发出


服务器端:
tcp的read函数到pBuf
struct ST{
   int a;
   intb;
};
ST *tmpw = (ST*)pBuf;
printf("收到:%x%x   解析:%d %d \n",tmpw->b,tmpw->a,tmpw->b,tmpw->a);

解析数据有错误是什么情况啊,是不是大端小端的问题 ,具体怎么解决啊~!!
页: [1]
查看完整版本: windows向powerpc传送结构体的问题