Sscanf arguments limitation

Hey ROOTers !

I’m trying to read data from an ASCII file using the sscanf function, but since it contains more than 20 specific columns of data, it doen’t seem to work, I get this error :

Limitation: sscanf only takes upto 12 arguments HVana3_1.C:549:

Here’s what it looks like :


while (fgets(&line,200,fp)) {
if (strlen(line) < 10) continue;
sscanf((&line),"%d%d%3d%2d%s%2d%2d%s%s%d%s%s%s%2d",&hvpartition,&canbus,&mod,&cha,&ft,&ftnum,&ftch,&calo,&phi,&eta,&sec,&side,&eleinside,&numele);

I’m new to ROOT and C++, does anyone have an idea of what I could do ?

Thanks. Cheers.

see an example using ifstream instead of sscanf at
root.cern.ch/root/htmldoc/src/TN … tml#auO86E

and note that TNtupleD::ReadFile or TTree::readFile is probably the solution
to your problem without having to code yourself this task.
See also tutorials at
$ROOTSYS/tutorials/tree/basic.C, basic2.C and cernbuild.C

Rene