Skipping strings in data

I am having a problem skipping strings in the middle of my data.
My data looks like this:
Generator m cms n (this is a header)
Event: 1 5 6
Event: 2 2 2
Event: 3 2 4
Event: 4 3 8

What I need to do is skip the Event: and go straight to the numbers
My code looks like:

[code]
{
gROOT->Reset();
#include "Riostream.h"
ifstream in;

in.open(“starlight.out”)
Float_t x,y,z;
TFile *f=new TFile(“starlight.root”,“RECREATE”);
TNtuple *ntuple=new TNtuple(“ntuple”,“datat from ascii file”,“x,y,z”);

while(nlines<5)
{
scanf(starlight.out,%f,%f,%f, x,&x,&y,&z); // this is the problem area, I need one or two lines of code here to ignore the Event: string

if (nlines>5) break;
h1->Fill(x);
ntuple->Fill(x,y,z);
nlines++;
)
in.close();
f->Write();
}

this code works for a dummy file where I have removed the Event: string, but I have like 10,000 events, and lobviously don’t want to do that for all of them.
Can someone help me here?

Simply use string skip; in >> skip >> x >> y >> z; since the string you are trying to skip as no spaces in it.

Cheers,
Philippe

Hi,

I moved this topic from ROOT Documentation to ROOT Support because of the subject.

Cheers, Ilka