Re: writing/reading objects to/form a file

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Mon, 21 Nov 2005 11:52:39 +0100


Hi Chiara,

> root [15] file1->GetObject("ciccio",tc1)
> fPad = 0
>
> and here I'm not sure... I need the array, perhaps the Write method is
> not the correct one... anyway, I have done this:
>
> root [16] tc1->CreateArray()
> fPad = 0x9d44320

there's no need to create the array. ROOT calls the default constructor (which in your case prints out that fPad==0), and _then_ sets fPad to the objects read from file. So fPad will be correct after reading tc1, even though your default constructor shows fPad==0.

As I said, you should specify the array dimension //[npad], so ROOT knows how many objects to write.

> I hope not to bother you too much...

No problem - but let's remove roottalk from now on, as this is really a bit too specific for the general audience.

Axel. Received on Mon Nov 21 2005 - 11:52:30 MET

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