Code: Select all
c8* name;
strcpy(name,const_cast<irr::c8*> (selectedSceneNode->getName()));
Code: Select all
c8* name;
strcpy(name,const_cast<irr::c8*> (selectedSceneNode->getName()));
Code: Select all
const c8* name = node->getName();
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Note that the second parameter in the signature of strcpy is const char* (which is equivalent to const c8*)...nayon wrote:Hello everyone, I'm trying to get the name of a sceneNode and store it into a variable of type c8* for later usage. But I can't seem to do it. What I do is:
I tried separating it into steps, but the error happens at the const_cast. A memory location error. How can I solve this, is there an easy way?Code: Select all
c8* name; strcpy(name,const_cast<irr::c8*> (selectedSceneNode->getName()));
Code: Select all
char *strcpy(char *s1, const char *s2);
Code: Select all
char name [32]; // assumes all names are less than 31 characters
strcpy (name, node->getName ());
// now you can modify the contents of the name buffer
Code: Select all
core::stringc name = node->getName ();
// modify name using methods of the string class