怎样从内存中获取数据

来源:互联网 发布:php fsockopen post 编辑:程序博客网 时间:2024/04/30 01:42

假设aBuf指向一段内存:

BYTE* aBuf

我们要获取里面的数据,可如下获取:

char 型数据:

BYTE ClassID=*(aBuf+len); 

stDate=(short)(*((char*)(aBuf+len)));

short ,int16型数据:

stDate=(short)htons(*((short*)(aBuf+len)));

 

int32 型数据:

lDate=(long)htonl(*((long*)(aBuf+len)));

原创粉丝点击