I get this "heap corruption detected
" message after running this code :
uli& uli::operator =(char* n)
{
char* buffer = new char[strlen(n)];
char* p;
int op;
int coef;
strcpy(buffer, n);
while(*buffer)
{
op = strlen(buffer) - 5;
p = (op >= 0) ? op+buffer : buffer;
coef = atoi(p);
if(coef > 65535)
coef = atoi(++p);
push(head, coef);
*p = '\0';
}
delete buffer; // <- heap corruption detected
return *this;
}
This is how I call the method:
uli x;
x = "9876123";
What does "heap corruption detected" mean ?