Jump to content
  • Advertisement
Sign in to follow this  
C plus noob

How do you create and read in .xml files for your program?

This topic is 4622 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Quote:
Original post by stanVman
Could I use tinyXML to save and open HighScore struct's for my game?


Yes, if you wanted to. XML is just a format for data to be held in. Technically, you can store anything in XML, I've seen maps, models, html data, etc... used before. Now that's not going to say it's the *best* method, but it's do-able.

If you want to use XML with a high score table, you'd want to first design the format it will be taking on, such as:

<root>
<Entry>
<Name>Unknown</Name>
<Score>1000</Score>
<Rank>1</Rank>
</Entry>

<Entry>
<Name>Unknown 2</Name>
<Score>1000</Score>
<Rank>2</Rank>
</Entry>
</root>

Then it's just a matter of using TinyXML to properly parse that data and extract it. Not much to it really, keep in mind that there are alternatives that might be quicker and more suited for highscores though.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why optimise the High Score code for Speed?

P.S. You could also use an embedded SQL which might be better.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!