Re: [ROOT] Header in ascii file

From: Axel Naumann (axel-naumann@gmx.de)
Date: Thu Oct 16 2003 - 15:05:34 MEST


Hi,

now that's simple. The easiest way (using an excerpt from staff.C as an
example):

    int line=0;
    while (fgets(&line,80,fp)) {
       sscanf(&line[0],"%d %d %d %d
%d",&staff.Category,&staff.Flag,&staff.Age,&staff.Service,&staff.Children);
       sscanf(&line[32],"%d %d  %d %d %s
%s",&staff.Grade,&staff.Step,&staff.Hrweek,&staff.Cost,staff.Division,staff.Nation);
       if (line++)>6) tree->Fill();
    }

Axel.

> 	Hello everybody
>
> 	I'm trying to read an ascii file and write a root tree with the data,
> very similar to the example in
> http://root.cern.ch/lxr/source/tutorials/staff.C. The problem is that the
> original ascii table has a character header which is read as 0s. How can
> I read the file from the 6th row on, for instance??
>
> 	Thanks in advance,
>
> 	Regards
>
> 	  Joaquin
>
>
>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET