Re: [ROOT] TFile/TDirectory

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 26 2003 - 13:07:10 MET


Hi Susan,

In the version in CVS, TDirectory::SaveSelf writes automatically
to the right place. Thanks for this remark.

Rene Brun

Susan Kasahara wrote:
> 
> 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