TinyXML GetText()
Hello,
I would like to ask, how to load more data with GetText() ?
I am trying to load collada file and it contains 10000+ characters. it loads only first 256 letters.
data are between in <triangles>.
Thank you.
Using TiXmlElement::GetText?
I don't think that should be limiting the text returned - what does your code look like that calls this method?
I don't think that should be limiting the text returned - what does your code look like that calls this method?
const char * INDICES_DATA = NULL;
POLYGONS = MESH->FirstChildElement("triangles");
if(POLYGONS)
{
P = POLYGONS->FirstChildElement("p");
INDICES_DATA = P->GetText();
}
INDICES_DATA contains string of numbers. Length of string is really 10000+ .
Thank you for reply
EDIT: it works, when i create array like char INDICES_DATA[50000];
but when i allocate it , it doesn't work, lol, strange
[Edited by - wh1sp3rik on November 4, 2009 6:46:36 AM]
What are the types of POLYGONS and P?
Are you sure POLYGONS is non-null, i.e., that GetText is actually being called?
Are you sure POLYGONS is non-null, i.e., that GetText is actually being called?
Quote:Original post by wh1sp3rikWhat do you mean by "allocate it"? Can we see an example where it does and doesn't work?
EDIT: it works, when i create array like char INDICES_DATA[50000];
but when i allocate it , it doesn't work, lol, strange
Have you read the caveat / limitation of GetText? Is all the text you want to retrieve in the <p> element and not delimited by another child element? (although a quick look at the COLLADA spec says it shouldn't be)
How are you determining that the length of the string is 256?
I don't follow you here. GetText returns a const char *.. how are you putting it into that array?
How are you determining that the length of the string is 256?
Quote:EDIT: it works, when i create array like char INDICES_DATA[50000];
but when i allocate it , it doesn't work, lol, strange
I don't follow you here. GetText returns a const char *.. how are you putting it into that array?
this works :)
char INDICES_DATA[500000];
int len=0;
POLYGONS = MESH->FirstChildElement("triangles");
if(POLYGONS)
{
P = POLYGONS->FirstChildElement("p");
len = UtilityManager::char_length(P->GetText());
memcpy(INDICES_DATA, P->GetText(), sizeof(char)*len);
}
LEN is 380650, yeah, pretty big collada model :D
by allocate it, i mean
char * INCIDES_DATA;
...
INDICES_DATA = new char[len];
...
this doesn't work, it will save only length about 256 letters.
char INDICES_DATA[500000];
int len=0;
POLYGONS = MESH->FirstChildElement("triangles");
if(POLYGONS)
{
P = POLYGONS->FirstChildElement("p");
len = UtilityManager::char_length(P->GetText());
memcpy(INDICES_DATA, P->GetText(), sizeof(char)*len);
}
LEN is 380650, yeah, pretty big collada model :D
by allocate it, i mean
char * INCIDES_DATA;
...
INDICES_DATA = new char[len];
...
this doesn't work, it will save only length about 256 letters.
Can you post the exact code that doesn't work, when you try to dynamically allocate INDICES_DATA?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement