Skip to main content
GameDev.net gamedev.net
🔒 Locked

[Solved]TinyXml problems?

Started by PaulHolverda Sep 1, 2009 at 5:53 AM 1 replies 950+ views
Original Post
PaulHolverda
PaulHolverda
Hi all, i've got a small but rather annoying problem, all doubles stored inside a xml file are truncated this for instance becomes: (0, 0, 148) when parsing while i'm using the following code

if(sibbling)
{
         double x, y, z;
         sibbling->QueryDoubleAttribute("x", &x);
         sibbling->QueryDoubleAttribute("y", &y);
	 sibbling->QueryDoubleAttribute("z", &z);
	 setPosition(Vector3d(x,y,z));
	 setPivot(Vector3d(0,0,0));
}


I've been browsing to the c++ files of tinyxml, but ultimately parsing a double comes to a: #define TIXML_SSCANF sscanf_s

int TiXmlAttribute::QueryDoubleValue( double* dval ) const
{
	if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 )
		return TIXML_SUCCESS;
	return TIXML_WRONG_TYPE;
}


call but somewhere along the route all its decimals places are getting truncated, anyone knows how this is happening, because i really don't have any clue, regards Paul [Edited by - PaulHolverda on September 1, 2009 9:16:12 AM]
dave
dave
I use TinyXML and i have not had this problem loading in floating point coordinates.
PaulHolverda
PaulHolverda
Edit: i just parse it myself now.. goes fine

Edit 2: this fixed everything:

setlocale(LC_NUMERIC,"C");

regards

Paul

[Edited by - PaulHolverda on September 1, 2009 8:22:48 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.