Re: [ROOT] limitation in number of arguments in fscanf

From: Stephen Bailey (bailey@physics.harvard.edu)
Date: Thu Dec 07 2000 - 18:38:55 MET


Hi.

I just ran into this same problem a few days ago.  I solved
this by reading in my variables in two fscanf statements per
input line of my file.  e.g.

float x[12];
fscanf(file, "%f %f %f %f %f %f",
       &x[0], &x[1], &x[2], &x[3], &x[4], &x[5]);
fscanf(file, "%f %f %f %f %f %f\n",
       &x[6], &x[7], &x[8], &x[9], &x[10], &x[11]);

The second fscanf picks up where the first one left off, not at
the next line.

Happy coding.

Stephen


On Thu, 7 Dec 2000, Muge Karagoz wrote:

> Hello,
> Being a freshmen in using Root, i have a problem... 
> I wrote a small macro with which i plan to read 11 different variables out
> of a data file and write them into an ntuple.
> I tried to use "fscanf()" but it gives me the error message below:
> --
> Limitation: fscanf only takes upto 12 arguments FILE:make_ntuple.C LINE:17
> *** Interpreter error recovered ***
> --
> i have 11 variables + format + file pointer =13 as the number of
> arguments..
> I don't remember to have this limitation with a regular c program ...
> 
> Could anyone please make me a suggestion?
> 
> thanks
> Muge Karagoz
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET