p73
1
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?
linev
2
Hi,
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) );
p73
3
Oh. I forgot the Form
function. Thank you, Sergey.
system
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.