Re: [ROOT] How to recognize corrupted files ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 10 2002 - 22:21:59 MEST


Hi Frank,

You can do:

TFile *file = TFile::Open(...);
if (file->IsZombie()) {
  //file is overwritten, invalid, etc
}

Rene Brun

On Thu, 10 Oct 2002, Frank Laue wrote:

> Hi:
> 
> When opening a corrupted file (maybe not closed properly) with
> TFile::Open(...) ROOT does open the file and prints some warnings on the
> screen. Is there any other means to identify that files as bad.
> 
> Is there a return value or a flag that one can easily check on in a
> program ?
> 
> Thanks.
> 
> Cheers,
> 	Frank
> 
> 
> 
> > -----Original Message-----
> > From: owner-roottalk@pcroot.cern.ch 
> > [mailto:owner-roottalk@pcroot.cern.ch] On Behalf Of Rene Brun
> > Sent: Thursday, October 10, 2002 11:16 AM
> > To: Avdhesh Chandra
> > Cc: roottalk@pcroot.cern.ch
> > Subject: Re: [ROOT] graph array problem
> > 
> > 
> > Hi,
> > 
> > I do not understand if what you try to do is:
> >   - an array of TGraphErrors
> >   - or one single TGraphErrors build with an array of points
> >     and associated errors.
> > 
> > Please clarify by sending a complete running script.
> > 
> > Rene Brun
> > 
> > 
> > 
> > On Thu, 10 Oct 2002, Avdhesh Chandra wrote:
> > 
> > > 
> > > Hi,
> > >     I am trying to make graph array, so i can use it.
> > > 
> > >  programe looks like(where i am defining graph array)
> > > 
> > >  for(int i = 0 ; i < nent ; i++)
> > >    {
> > >      cout << "  Col[i]  " << Col[i] << endl;
> > >      gr[i] = new TGraphErrors(n,Z,Ent[i],Ez,Eent[i]);
> > >      gr[i]->SetMarkerColor(Col[i]);
> > >      gr[i]->SetMarkerStyle(Sty[i]);
> > >    }
> > > 
> > > when i am running my code  i am getting following message
> > > 
> > > ---------------------------------------------------
> > >   Col[i]  7
> > >   Col[i]  6
> > > Error: Array index out of range gr -> [1]  valid upto gr FILE:test.C
> > > LINE:156
> > > 
> > >  *** Break *** segmentation violation
> > > ---------------------------------------------------
> > > 
> > > 
> > > Which shows that when it goes secound time in the loop it 
> > having problem.
> > > Please let me know what i am doing worng.
> > > 
> > > Thanks for any help
> > > Avdhesh
> > > 
> > 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET