Hi I have ten and more data files.I want to plot them in a loop. But the error messege is occuring:(for two files only) 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:15 *** Interpreter error recovered *** ******************************************************** { 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[0]; fp[0] = fopen("pt1.dat","r"); FILE *fp[1]; 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]); } } ****************************************************************** can anybody help? Thanks in advance. Subhendu Chakrabarti
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET