My program keeps crashing when the retrieve function calls the getName function. I'd like to make sure my getName function is correct before tinkering with my retrieve function. I'd appreciate any ideas. Is there a problem with deleting the name if it's a pointer?
header file:
void getName(char * name)const;
.cpp file:
void data::getName (char * name)const
{
if(name)
delete[]name;
name = new char[strlen(name)+1];
strcpy(name, this->name);
}