是否可以剪切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);
答案 0 :(得分: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.