How to read and write float attributes with TXMLEngine?

I work with TXMLEngine class. And sometimes I need to read or ( more important ) write float attributes. The question is how to do it in a proper way?

To read I use atof from C. And it is not very ugly.

        effS = atof( xml->GetAttr( bin, "effS" ) );     
        effB = atof( xml->GetAttr( bin, "effB" ) );     

But what should I do in order to write float attribute?


There are many methods to convert float to the string.
In the ROOT you can use Form() construct:

float abc = 123.45;
XMLNodePointer_t info = xml->NewChild( generalInfo, 0, "Info" );
xml->NewAttr( info, 0, "name", "TrainingSignalEvents");
xml->NewAttr( info, 0, "value", Form("%f", abc) );

Oh. I forgot the Form function. Thank you, Sergey.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.