Hi,
I want to save ascii file data in to my ttree. However, the problem is that for every ascii file, I have some explanation on the top part of the file. This text makes me hard to bring only the data numbers. My code is as follows
void oscilloscope()
{
fstream file;
file.open("c1test.txt", ios::in);
double x, y;
TFile *output = new TFile("c1test.root", "RECREATE");
TTree *tree = new TTree("tree", "tree");
tree->Branch("x", &x, "x/D");
tree->Branch("y", &y, "y/D");
while(1)
{
file >> x >> y;
if(file.eof()) break;
cout << x << " " << y <<endl;
tree->Fill();
}
output->Write();
output->Close();
file.close();
}
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided