Re: error while converting data

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Sat, 19 Mar 2005 14:42:43 +0100 (MET)


See solutions in the attachement.
Main message:
  -do not mix data types of different size in the same branch   -use a class instead od structs

Rene Brun

On Sat, 19
Mar 2005, Ivan Koji Koga
wrote:

> Dear all,
> I'm having problems when trying to convert data from string to float.
> I'm using the TSQLServer to connect to a database that return only
> string values and then i want to insert in the tree like float.
> I made a structure to hold variables float like
> struct roundtrip {
> Int_t testid;
> Int_t microseconds;
> Int_t sourceid;
> Int_t destid;
> char datetime[20];
> Float_t delay;
> Float_t jitter;
> Float_t loss;
> };
> and then i connect to a database, make the select and after i try to
> convert the data to float like:
> vround.delay = atof(row_round->GetField(j));
> Then i print some values
> printf("%f \n",vround.delay);
> When i print the values all apear ok. But if i verify the values in the
> tree they are all the same and wrong!
>
> Does anybody knows how to fix it?
>
>

Received on Sat Mar 19 2005 - 14:42:49 MET

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