I’m trying to write a function that takes a line as a string and converts it into a Node.
Node convertLineToNode(string line){
char lineC[] = line;
Node *n = new Node();
n->lastname=strtok(lineC," ");
n->name=strtok(lineC," ");
n->ID=strtok(lineC," ");
}
However it doesn’t work properly. It expects the string line as char array. I couldn’t convert it into char array. Is there any solutions for my problem?
The C++ way would be this:
consider returning a shared_pointer instead of a raw one