gpt4 book ai didi

C++ 剪切字符指针

转载 作者:行者123 更新时间:2023-11-28 00:42:05 26 4
gpt4 key购买 nike

是否可以切割字符指针以删除包头?

为了避免循环:

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com