Hi rooters,
I did follow the suggestion of Rene, which I thank very much, for opeing
all file of a directory and
I did write the following macro, but it doesn't work.
{
gROOT->Reset();
//open all files in the current directory
void *dirp = gSystem->OpenDirectory(".");
const char *afile;
while(afile = gSystem->GetDirEntry(dirp)) {
printf("file: %s\n",afile);
FILE *fp = fopen(afile,"r");
TFile *f = new TFile("./afile.root","RECREATE");
Float_t y;
Int_t ncols;
Int_t nlines = 0;
while (1) {
// read data in each file
ncols = fscanf(fp,"%f",&y);
if (ncols < 0) break;
nlines++;
}
printf(" found %d points\n",nlines);
fclose(fp);
f->Write();
}
}
The error message is the following
root [2] .x open_read.C
file: .
found 0 points
file: ..
found 0 points
file: file1
Error: fscanf param[0]=0 must not be 0
FILE:/home/paola/root/macros/open.C LINE:22
What's the problem ?
Thanks for any help. Paola.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET