Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以剪切 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);
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.