1

code like this:

int totalLen = 50;

int usTest = htons(totalLen);

char* strBuf = new char[totalLen ];

memcpy(strBuf,&usTest,sizeof(int));

after this,there is nothing in strBuf, why?

but if I put a big number, like 100000001, it will be OK?

what's the problem?

0 Answers0