Hello
I am in a question of assigning local scope pointers to global scope pinters.
I have a code like this.
public :
char* myValue;
void process(TiXmlElement *element)
{
myValue= element->getText();
}
But once the process function is returned value is garbage.
So I did this.
public :
char* myValue;
void process(TiXmlElement *element)
{
char* textVal = element->GetText();
myValue= new char[sizeof(textVal)];
memcpy(myValue, textVal, sizeof(textVal));
}
But still part of it is garbaged.
element->GetText() returnes "menustate" but when print 'myValue' it prints
menu²²²²♦
Could you plase tell me to do what.
Thank you