65,187
社区成员




int main(int argc,char *argv[])
{
char *pMsg = new char[4];
int nTmpLen = htonl(93);
strncpy(pMsg,(char *)&nTmpLen,4);
int nLen;
strncpy((char*)&nLen,pMsg,4);
nLen = ntohl(nLen);
cout<<nLen<<endl;
delete pMsg;
pMsg = NULL;
return 0;
}
int main(int argc,char *argv[])
{
char *pMsg = new char[4];
int nTmpLen = htonl(93);
memcpy(pMsg,(char *)&nTmpLen,4);
int nLen;
memcpy((char*)&nLen,pMsg,4);
nLen = ntohl(nLen);
cout<<nLen<<endl;
delete pMsg;
pMsg = NULL;
return 0;
}