Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / TinyXML

Author
Message
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 5th Jun 2009 12:14 Edited at: 6th Jun 2009 09:34
Sadly, i've spent the past fifteen hours trying to get TinyXML to do what I think should be a simple task.

Here's the code of what i'm doing:


Here is the .xml document:


Alright!
You can see the commented out code after 'if (loadok == true)' where i've been trying different approaches.

What seems to be happening is that as soon as the if statment, 'if (loadok == true)' actually triggers, my application crashes and throws an exception!

Fifteen hours and I can't crack this. I'm probably going about everything 100% incorrect. Someone set me straight? Lol.

Edit: I finally solved the problem on my own, turns out I was doing a few things wrong, sorry that i've double posted a few times, this bug was really bothering me >.<

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 5th Jun 2009 13:31
I don't use TinyXML so I can't help much but I have some suggestions:

1. You need to deallocate the memory of the string returned by mnGetStringC using delete[] at some point to avoid a memory leak.
2. I don't think 'char fi[255];' is guaranteed to start with a null terminator so strcat may not start at the start of the string.
3. You should comment your code more so that you and others can understand it.

I suggest reading the TinyXML documentation and looking at examples. Also, you should work out exactly where things start going wrong by using break points. That way you can see which commands you are using incorrectly.

kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 5th Jun 2009 14:19
The exact place the problem is going wrong is where i'm trying to read a value from the .xml document with tinyxml and I must be doing it wrong because it throws an exception, i've put things into the code to narrow it down to the function, those things have just been removed since I found out the exact spot the exception was occuring.

here:

The commented out code was from when I was trying a different method to complete the same task but it just gave me another exception.
I'm pretty sure it's just because i'm using tinyxml's functions incorrectly to try and return something from the .xml document, I just can't for the life of me figure out how to use it correctly.

kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 6th Jun 2009 01:59 Edited at: 6th Jun 2009 09:35
Maybe I could refine this and ask, could someone post a very basic basic way to read data from a .xml document with tinyxml

The tutorials it comes with is too confusing it goes over too much to quickly and it goes over a lot.

=/

Edit: I finally solved the problem on my own, turns out I was doing a few things wrong, sorry that i've double posted a few times, this bug was really bothering me >.<

Login to post a reply

Server time is: 2024-11-25 10:40:20
Your offset time is: 2024-11-25 10:40:20