내 코드의 일부는 char :복사 문자 * 여기 *
AccessViolationException:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
문제는 때문입니다 : 내가 외부 응용 프로그램에서이 함수를 호출 할 때 지금
extern "C" REGISTRATION_API int extreme(char* lKey)
{
string s1;
char *p=NULL;
try
{
ifstream myfile ("extreme.txt");
int i=0;
if (myfile.is_open())
{
while (getline(myfile,s1))
{
switch (i)
{
case 1:
strcpy(p,s1.c_str());
lKey=p;
break;
//continue here
}
}
}
}
,이 오류가 발생합니다 이 :
lKey=p;
가 어떻게 할당 할 수 lKey
p
에?
여기서 포인터 p에 메모리를 할당 했습니까? –