恭喜,你发布的帖子
发布于 2020-09-19 14:34:53
4楼
楼主可以写几个函数:
int GetInt(const char *p, int offset)
{
WORD refInt = SwapDWord(p + offset);
return refInt;
}
float GetReal(const char *p, int offset)
{
DWORD refInt = SwapDWord(p + offset);
return *((float)&refInt);
}
DWORD SwapDWofd(const char *p)
{
DWORD x = 0;
char *q = (char*)&x;
q[0] = p[3], q[1] = p[2], q[2] = p[1], q[3] = p[0];
return x;
}
WORD SwapDWofd(const char *p)
{
WORD x = 0;
char *q = (char*)&x;
q[0] = p[1], q[1] = p[0];
return x;
}
请填写推广理由:
分享
只看
楼主