我想通过使用memcpy将结构数组的元素复制到另一个结构数组的元素。我相信这会导致我的程序由于某种原因失败。另外我怎样才能最终释放内存?C++ struct array copy
struct FaultCodes
{
string troubleFound;
string causeCode;
string actionCode;
string paymentCode;
string suppCode;
u_int16_t multiplier;
};
struct JobFaultInfo
{
static const size_t NUM_CODES = 5;
FaultCodes codes[NUM_CODES];
};
FaultCodes codes[JobFaultInfo::NUM_CODES];
// I have populated codes with the data.
JobFaultInfo info;
memcpy(info.codes, codes, sizeof(FaultCodes)*JobFaultInfo::NUM_CODES);
非常感谢..哎呀我怎么会不知道:P ... – nixgadgets 2010-10-15 05:43:01