我有这个 c++ 结构
struct PACKET
{
BOOL isTCPPacket;
BOOL isUDPPacket;
BOOL isICMPPacket;
BOOL isIGMPPacket;
BOOL isARPPacket;
BOOL isIPPacket;
struct PETHER_HEADER
{
string DestinationHost;
string SourceHost;
struct PROTOCOL_TYPE
{
string Name;
WORD Identifier;
} ProtocolType;
} EthernetHeader;
};
我有
PACKET* Packet;
PACKET* Packets[6];
例如,我如何将 Packet 的内容复制到 Packets[3] 中,知道 Packet [INDEX] 中每个数组的数据包内容会有所不同
我已经尝试过 memcpy
memcpy((void*)&Packets[i],(void*)&Packet,sizeof(PACKET));
没有运气