Can ROOT read an ascii file using MATCH as in PAW?

I am wondering if I can fill a ntuple from an ascii file only from the line having a ‘DATA’ tag.
like this:
DATA 17 80.6473 54.8704 64.5842

thanks for any reply!


Proceed like in $ROOTSYS/tutorials/cernbuild.C
and eliminate all lines that do not contain “DATA”, eg

while (fgets(&line,80,fp)) {
if (!strstr(line,“DATA”)) continue;


Ok, I used fgets(…) and sscanf(…) to read a ‘DATA’ line, while each line contains 13 data leaves, so I got this:
"Limitation: sscanf only takes upto 12 arguments ".
Aftet a search in CINT FAQ, I found ifstream is recommended…
So I use

string data;
if(data.find(“DATA”)) continue;
// here it’s my responsibility to split the line string into number…??


Am I right? or if fortunate, is there any constructed method to fulfill this split job?

Thanks a lot for reply!