Advertisement Jump to content
Sign in to follow this  

Loading Hex Values with tinyXML

This topic is 3835 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

Hello all. Any one know of a way to load hex values written in a 0xff332255 or ff332255 style and load them with tinyxml. Or will I be better off loading a string and then writing a conversion function? I'm using this for loading color values for Gui elements and it makes a lot more sense to me to write ff332255 over 4281541205.

Share this post

Link to post
Share on other sites
Original post by NisseBosseLasse
Couldn't you save the values in RGB-format, and parse that instead?

EDIT: I mean as 0-255, in tags of <R>255</R> or so...

I very easyly could, but the way I am using the values as DWORDs in my program so I'd have to convert them once I've loaded the values, and I am getting my color values from a color picker that gives me the Hex value. I also have become very accoustumed to reading hex as colors and it will keep everything nice and condensed in my xml file.

I think I am just going to load them as strings and use a std::istringstream and std::hex. Works well enough.

EDIT: humm seemed to have missed strtoi/_strtoi64 will try this as well;

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!