[size=125]I use Root 5.17.02 installed on Windows xp. I launch automatically ROOT starting from microsolft visual BASIC 6.0 using following script:[/size]
[quote]Private Sub Form_Load()
Shell "C:\root\bin\root.exe C:\root\test.C"
End Sub[/quote]
the program that I try to carry out in ROOT is as follows:
[quote]#include “TH1F.h”
#include “TCanvas.h”
#include “Riostream.h”
void test()
{
gROOT->Reset();
ifstream in;
in.open(“data.dat”);
Float_t x;
Int_t nlines = 0;
// TFile *f = new TFile(“data.root”,“RECREATE”);
TH1F*h1 = new TH1F(“h1”, “X distribution”,100, 0,100);
while (1) {
in >> x ;
if (!in.good()) break;
h1->Fill(x);
nlines++;
}
printf(" found %d points",nlines);
in.close();
// f->Write();
TCanvas *C1 = new TCanvas(“1X”, “1X”,1);
h1->Draw();
}[/quote]
[size=125]The program carried out, the “canvas” appeared, the axes are drawn
but the histogram does not appear. and the program write
0 points found (enty 0). What means that it does not manage to open the file containing data to read them.
On the other hand when I launch my program directly in ROOT using .x test.C it is carried out normally data are read without problem.
I have carry out tests with other programs and the behavior is the same one. each time that there is data to read they are not read.
On the other hand when there is not data to read the program is carried out without problem. This problem poisons my life since more than one week and I do not manage to find an explanation. What does it occur? what can I make to cure it?
Thank you in advance for your answer
[/size]