0

是否可以剪切 char 指针以删除数据包头?

为了避免循环:

Decryptor dec;
char * datae = new char[_packet[0] - 8];
char * decrypted;
for(int i = 0;i<_packet[0] - 8;i++)
{
    datae[i] = _packet[8+i];
}
decrypted = dec.decrypt(datae, _packet[0]-8);
4

1 回答 1

3
Decryptor dec;
char * decrypted = dec.decrypt(_packet + 8, _packet); // _packet[0] - 8 is going to give you the value of the character at _packet[0] minus 8, which is not likely to be what you want.
于 2013-08-21T16:05:21.443 回答