Hi Satoru KAMEOKA,
TIter next(gROOT->GetListOfGlobals());
TGlobal *global;
TFile *file;
while ((global=(TGlobal*)next())) {
TString type;
type = global->GetTypeName();
if (type=="TFile") {
file = (TFile*)gInterpreter->Calc(global->GetName());
printf("%s: %s\n", global->GetName(),file->GetName());
}
}
HTH. Regards. Valeriy
> Hi, Valeriy,
> Thank you for reply.
> The way you taught surely shows file name and its contents, but not
> associated object "instance name".
>
> What I hope is, when some files are opened,
> root[] TFile f1("foo.root")
> root[] TFile f2("bar.root")
> root[] TFile f3("hoge.root")
>
> some command can show the list as below.
> root[] some_command
> f1 "foo.root"
> f2 "bar.root"
> f3 "hoge.root"
>
> Yes, I can understand that we can easily retrieve TFile object pointer
> from file name even if I've fogotten the instance names(f1, f2, f3).
> But I feel such command would be useful, because I sometimes attempt
> to use already connected TFile object by mistake and cause
> segmentation violation, like
> root[] TFile f("A_file.root")
> root[] TFile f("Another_file.root")
>
> Anyway, thanks a lot.
>
> Best regards,
> S.Kameoka
>
> From: "Valeriy Onuchin" <Valeri.Onoutchine@cern.ch>
> Subject: Re: [ROOT] How to list files
> Date: Mon, 28 Jul 2003 17:07:52 +0200
> Message-ID: <028001c3551a$04c250a0$c1848a89@cern.ch>
>
> > Hi Satoru,
> >
> > TIter next(gROOT->GetListOfFiles());
> > TObject *obj;
> > while ((obj=next())) obj->ls();
> >
> > HTH. Regards. Valeriy
> >
> > > Dear ROOT developers and users,
> > >
> > > is there any way to list currently opened files?
> > > I found gROOT->GetListOfFiles()->Print() prints file names,
> > > but I want to know also associated TFile object instance names
> > > as "ldir //" command of PAW shows file name and LUN.
> > >
> > >
> > > Best regards,
> > > Satoru Kameoka
> > >
> > >
> >
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET