是否可以切割字符指针以删除包头?
为了避免循环:
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);
最佳答案
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.
关于C++ 剪切字符指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18362157/