RE: Inserting data in ROOT(data conversion problem)

From: Bertrand Bellenot <>
Date: Tue, 8 Mar 2005 12:25:43 +0100

Hi Ivan,

Replace &vatraso.atraso=9999; by vatraso.atraso=9999;


And &vatraso.atraso = tempint; by vatraso.atraso = tempint;


It will works.


-----Original Message-----
[] On Behalf Of Ivan Koji Koga Sent: Tuesday, March 08, 2005 11:45 AM
Subject: [ROOT] Inserting data in ROOT(data conversion problem)

Hello all,
I have been using ROOT to insert some values and they appear like all have the same value. I think that it's some error on the data conversion

when i try to convert string to int, but i don't know what i'm doing wrong. The 104-10-06-0084.icmp is a file that contain some network delay values

0 59
60 58
120 58
180 57
240 loss
300 61
360 58
420 loss
480 58
540 57

On the left we have timestamp values and on the right delay values that can be "loss" or numeric int.
Can anyone tell me what is wrong in the code and how to correct it?


struct tipo_atrasos {

    Int_t timestamp;
    Int_t atraso;

tipo_atrasos vatraso;
char line[80];
char temp[80];
char temp1[80]="loss";
int tempint;
//open file

FILE *at = fopen("/104-10-06-0084.icmp", "r");

// new TFile

TFile *f = new TFile("dadosAMP.root", "RECREATE");

// new TTree

TTree *arvore = new TTree("arvore", "dados do amp");

//new Brach

arvore->Branch("galhoAMP", &vatraso.timestamp, "timestamp/I:atraso");

//fill the values

sscanf(&line[0],"%d%s", &vatraso.timestamp, &temp);

//if it's loss then delay = 9999

printf("loss \n");

else {
//if not loss receive the numeric value

&vatraso.atraso = tempint;
//Print and close;

} Received on Tue Mar 08 2005 - 12:26:01 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET