代码如下: int AdapterNum=0; char AdapterName[8192]; // string that contains a list of the network adapters char *temp,*temp1; int i; ULONG AdapterLength; char AdapterList[Max_Num_Adapter][1024]; AdapterLength=4096; PacketGetAdapterNames(AdapterName,&AdapterLength); temp=AdapterName; temp1=AdapterName; while ((*temp!='\0')||(*(temp-1)!='\0')) { if (*temp=='\0') { memcpy(AdapterList[i],temp1,(temp-temp1)*2); temp1=temp+1; i++; }
temp++; } AdapterNum=i;Debug时显示消息提示框:unhandled exception in ***.exe(MSVCRTD.DLL):0xC0000005:Access Violation.
代码如下: int AdapterNum=0;
char AdapterName[8192]; // string that contains a list of the network adapters
char *temp,*temp1;
int i;
ULONG AdapterLength;
char AdapterList[Max_Num_Adapter][1024];
AdapterLength=4096; PacketGetAdapterNames(AdapterName,&AdapterLength);
temp=AdapterName;
temp1=AdapterName;
while ((*temp!='\0')||(*(temp-1)!='\0'))
{
if (*temp=='\0')
{
memcpy(AdapterList[i],temp1,(temp-temp1)*2);
temp1=temp+1;
i++;
}
temp++;
}
AdapterNum=i;Debug时显示消息提示框:unhandled exception in ***.exe(MSVCRTD.DLL):0xC0000005:Access Violation.
memcpy(&AdapterList[i],temp1,(temp-temp1)*2);