I use version 2.6.1 in Borland c++ 5.02 and I need to undefine "TIXML_SAFE" (very old compiler). In this case, i got compiler errors for "TIXML_SSCANF" in tinyxml.cpp line 1191: to correct the bug, I added these precompiler tests to the code:
int TiXmlAttribute::QueryIntValue( int* ival ) const { [b] #if defined TIXML_SSCANF[/b] if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) [b] #else if ( scanf( value.c_str(), "%d", ival ) == 1 ) #endif[/b] return TIXML_SUCCESS; return TIXML_WRONG_TYPE; } int TiXmlAttribute::QueryDoubleValue( double* dval ) const { [b] #if defined TIXML_SSCANF[/b] if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) [b] #else if ( scanf( value.c_str(), "%lf", dval ) == 1 ) #endif[/b] return TIXML_SUCCESS; return TIXML_WRONG_TYPE; }
I made a mistake: one should use "sscanf" instead of "scanf" !!
Log in to post a comment.
I use version 2.6.1 in Borland c++ 5.02 and I need to undefine "TIXML_SAFE" (very old compiler).
In this case, i got compiler errors for "TIXML_SSCANF" in tinyxml.cpp line 1191:
to correct the bug, I added these precompiler tests to the code:
I made a mistake: one should use "sscanf" instead of "scanf" !!