Re: [ROOT] errot in reading array of files

From: Subhendu Chakrabarti (subhendu@tifr.res.in)
Date: Fri Oct 11 2002 - 21:38:54 MEST


I have corrected my code .Still the problem persists.
Thanks for helping.

{
gROOT->Reset();
c1 = new TCanvas("c1","yscan ",1100,50,800,600);
c1->SetGridx();
c1->SetGridy();


Int_t m=113;
Float_t x[m],y[m],w[m],z[m],v[m],ny[m],d[m],

FILE *fp[2];
fp[0] = fopen("pt1.dat","r");
fp[1] = fopen("pt2.dat","r");


for(Int_t j=0;j<2;j++){
for(Int_t i=0;i<m;i++)
  {
fscanf(fp[j],"%f",&x[i]);
fscanf(fp[j],"%f",&y[i]);
fscanf(fp[j],"%f",&w[i]);
fscanf(fp[j],"%f",&z[i]);
fscanf(fp[j],"%f",&v[i]);
if(y[i]<0)
  {
ny[i]=-y[i];
  }
else ny[i]=y[i];


}

TGraph *gr[j] = new TGraph(m,ny,z);
 

 gr[j]->SetLineColor(j+1);
  gr[j]->Draw("AC");

  fclose(fp[j]);
    }
  }
***********************************************
Warning: Automatic variable fp[0] allocated in global scope FILE:ycomp.C
LINE:12
Error: Array index out of range fp[1] -> [1]  valid upto fp FILE:ycomp.C
LINE:13
*** Interpreter error recovered ***
*************************************************************

               
        Subhendu Chakrabarti   

                



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