Hi Alexis, You can do something like: (assuming you keep only the highest cycle) fArr=new TObjArray(fFile->GetNkeys()); fNext=new TIter(fFile->GetListOfKeys()); TKey *akey; while ( (fKey=(TKey*)(*fNext)() )) { akey = (TKey*)fArr->FindObject(fKey->GetName()); if (akey) fArr->Remove(akey); fArr->Add(fKey->ReadObj() ); } Rene Brun Mignon Alexis wrote: > > Hi, > > I would like if there is a standard way of getting the content of a > file into a TObjArray avoiding problems with the several cycles of the > same TObject. > I explain : > > I use the way given in the Root Manual : > > fArr=new TObjArray(fFile->GetNkeys()); > fNext=new TIter(fFile->GetListOfKeys()); > while ( fKey=(TKey*)(*fNext)() ) fArr->Add(fKey->ReadObj() ); > > with this, I get several times the same object where there are more > than one cycle. > > Is there a trivial solution I have not seen yet ? > > Thanks in advance. > > -- > Alexis Mignon > GANIL > Bd Henri Becqurel > 14076 CAEN Cedex 5 > France > tel: +(33) (0)231454680 > e-mail : mignon@ganil.fr
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:50 MET