[ROOT] TFile/TDirectory

From: Susan Kasahara (schubert@physics.umn.edu)
Date: Wed Feb 26 2003 - 01:07:03 MET


Hi roottalk,
I've noticed that invoking TDirectory::SaveSelf requires one to
cd() to the directory of interest before invoking it, e.g.
   TFile* fTFile1 = new TFile("myfile1",...);
   TFile* fTFile2 = new TFile("myfile2",...);
   ...
    fTFile1 -> cd();
    fTFile1 -> SaveSelf();

This is because, I think, the TDirectory methods invoked by
SaveSelf (WriteKeys & WriteDirHeader) use
gFile instead of its data member fFile.  Is this a bug or an intended feature?
The danger is that if a user forgets to invoke: fTFile1->cd();,
the potential seems to be present for them to modify a differnt
file ("myfile2" in the example) unintentionally with the SaveSelf call.
-Sue



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET