> alberto Franzoso wrote:
> >
> > Hi everybody,
> > we are trying to write a list of data on a file.
> > We tried to launch "fprintf" from a Macro (automatically generated by
> > ROOT(MakeClass), to make a loop on a Tree), as follows:
> >
> > TCanvas *FinA = new TCanvas("FinA","Energy per plane",1);
> > FILE *sigmaf = fopen("sigma100.dat","w");
> > Float_t sigma[18];
> > for (Int_t i=1; i<=18; i++) {
> > EnergyOnPlane[i]->SetMaximum(1200);
> > EnergyOnPlane[i]->Draw();
> > EnergyOnPlane[i]->Fit("gaus");
> > sigma[i-1]=gaus->GetParameter(2);
> > fprintf(sigmaf,"%f \n",sigma[i-1]); <<<-----???
> > FinA->Update();
> > char w = getchar();
> > }
> >
> > The file is correctly created, but appears to be empty... Any idea why?
> > Thanks,
> > Alberto
Have you close the file before re-reading it?
For example:
root [0] FILE *f= fopen("test.txt","w");
root [1] fprintf(f,"Hello\n");
root [2] system("ls -l test.txt");
-rw-r--r-- 1 bardelli nucl 0 Dec 6 14:37 test.txt
root [3] fclose(f);
root [4] system("ls -l test.txt");
-rw-r--r-- 1 bardelli nucl 6 Dec 6 14:37 test.txt
root [5]
Hope this helps
Luigi
-------------------------------
Luigi Bardelli
INFN Sezione di Firenze
E-Mail: bardelli@fi.infn.it
-------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:11 MET