I saved some objects in a root file but did not care to give a name to them:
root [2] file -> ls()
TFile** test.root
TFile* test.root
KEY: classA ;2 sd
KEY: classA ;1 sd
The usual way to retrieve them
classA *a = (classA*) file -> Get("name")
does not work.
How to retrieve such nameless objects?
((TKey*)(file->GetListOfKeys()->At(0)))->Print(); // (0), (1), ...
That helps to get the keys but how to get the object?
classA *a = ((classA*)(((TKey*)(file->GetListOfKeys()->At(0)))->ReadObj()));
1 Like
system
Closed
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.