I've cut out non-relevant parts of the code. The type of "id" is const std::string&.
Person Person::add(Person *p)
{
std::string test = p->getId();
char id1[11];
strcpy(id1, test.c_str()); // the crash happens at this point
}
So what am I doing wrong? This works well ("people" is a vector):
char id2[11]; strcpy(id2, people[i].getId().c_str());

New Topic/Question
Reply



MultiQuote





|