Dear Rooters,
Could anyone help me?
I am trying to open a list of files, but my code
is crashing if number of files greater then 4.
It gives an error:
root [0] .x theta_replace.C
Number of files to read 32
PPiFit_0200_0250_t.C
PPiFit_0250_0300_t.C
PPiFit_0300_0350_t.C
PPiFit_0350_0400_t.C
PPiFit_0400_0450_t.C //Crashes on that line
*** Break *** segmentation violation
Root > Error: ~TString() header declared but not defined
FILE:theta_replace.C LINE:48
Below is a code I am using:
{
gROOT->Reset();
TString FileList ="theta_replace.txt";
ifstream fin(FileList); //Reading the file names
if(!fin) {
cout << "cannot open theta_replace.txt \n";
return 1;
}
TString FileNamet[40];
TString FileName_tmp[40];
Bool_t skipWhite;
Int_t nfiles=0;
char tmp_filename[40][40];
do{
fin>>tmp_filename[nfiles];
FileName_tmp[nfiles]=tmp_filename[nfiles];
nfiles++;
}while(fin);
fin.close();
cout<< "Number of files to read " <<nfiles<<endl;
for(Int_t i=0;i<nfiles;i++){//loop thru files
FileNamet[i]=FileName_tmp[i];
FileNamet[i]+="_t.C";
}
ifstream* finput[40];
for(Int_t i=0;i<40;i++){finput[i]=NULL; }
for(Int_t i=0;i<5;i++){//loop thru files
cout<<FileNamet[i]<<endl;
finput[i] = new ifstream(FileNamet[i]);
if(!finput[i]) {
cout << "cannot open "<<FileNamet[i]<<"\n";
return 1;
}
finput[i].close();
delete finput[i];
}
}
//____theta_replace.txt_____//
PPiFit_0250_0300
PPiFit_0300_0350
PPiFit_0350_0400
PPiFit_0400_0450
PPiFit_0450_0500
PPiFit_0500_0550
Thanks,
Rustam
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET