Aug 5, 2013 at 12:27pm UTC
strdup() is not a standard function.
it's very likely that malloc() is used to get the memory and hence you must use free() to discard it. Using delete in this case will fail
Aug 5, 2013 at 12:53pm UTC
why ? i didn't know it fail here, but why?
Aug 5, 2013 at 12:59pm UTC
why strdup is not standard ? what do you mean ?
so i must use strcpy () ? I think it's just like that
Aug 5, 2013 at 1:00pm UTC
malloc()
/free()
and new
/delete
are not compatible
Aug 5, 2013 at 1:30pm UTC
i used malloc and free,
the last problem in destructor ,not happend, but it breaks in another file,
it breaks in file " dbgheap.c" in part " if " from this code that i wrote below :
extern "C" static int __cdecl CheckBytes(
unsigned char * pb,
unsigned char bCheck,
size_t nSize
)
{
int bOkay = TRUE;
while (nSize--)
{
if (*pb++ != bCheck)
{
Aug 5, 2013 at 2:16pm UTC
thanks too much, the problem was from constructor with parametr, when i use it to make an object, before set every thing, i must call defult constructor in cinstructor with parametr to NULL every parameter.
I don't know why i must do that, but when i did this, it was no Error
thanks so mach.
Aug 5, 2013 at 2:28pm UTC
well yes, you must initialize a pointer otherwise you will face a crash.
From the code you showed here I cannot see what happend
Aug 5, 2013 at 3:48pm UTC
yes, it's true
thanks too much