I am getting an error that I don't understand. Compiler is VC7 on Windows XP
Pro. I am not a c/c++ guru so any help would be appreciated. I have already
scanned the newsgroups and understand that this error comes from writing
past an allocated memory block, but how am I doing this?
void Parameter::ValueDup(double val)
{
if (value != NULL) delete value;
sprintf(temp,"%lf",val);
value = strdup(temp);
}
This is a function in a class named Parameter... The error comes on the last
line of the function (strdup). I have checked the variables and everything
seems fine. Variable values just before the crash are the following...
val = 0.00000000000000000
temp = 0.000000
value = NULL
Both "value" and "temp" are class variables originally declared as
follows...
static char temp[256];
char *value; --> set to NULL in constructor
Any ideas?