Re: [Fwd: Problems in streaming a variable lenght array of TString]

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 5 Aug 2009 10:45:23 +0200


Dear Chiara,

You have a fundamental error in your class:   "A pointer to a string is not a pointer to an array of strings"  "A string is an array in itself.

To make your code working, simply replace in your header file

    TString* fString; //[fnentries] string value by

    TString* fString; // string value

Rene Brun

Chiara Zampolli wrote:
> Hi,
>
> Sorry in case you double receive this mail... I sent it yestarday,
> but I'm not sure it was properly received...
> Here it is.
> Cheers,
>
> Chiara
>
> **********************
>
> Hi,
>
> I have a problem when trying to write an object containing a
> variable length array of TString to a file. In fact, the object contains
> a variable length array of different types, which are initialized only
> if the corresponding constructor is called.
>
> In the attached file you can fine the class (AliDCSArray.h/cxx)
> where the array is, and a macro (test1.C) to write an object of that
> class in a file. The TString array is not initialized, in this
> example, while I initialize the Bool_t one.
> Here's what I get when exectuting the macro:
>
> root [0] .x test1.C
> Info in <TUnixSystem::ACLiC>: creating shared library
> /home/zampolli/FileDCSLHC/ForROOT/././AliDCSArray_cxx.so
> Error in <TStreamerInfo::WriteBufferAux>: The pointer to element
> AliDCSArray::fString type 501 (TString*) is null
>
> root [1] .q
>
> I know the error is related to that: the streamer can't write the
> TString pointer object if it is null. But why doesn't it complain for
> the other types? Am I doing something wrong? Am I missing somthing? Is
> there a workaround? Is this not supported at all? Do I need my own
> streamer? :-)
>
> Thanks, and cheers,
>
> Chiara
>
>
>
>
>
Received on Wed Aug 05 2009 - 10:44:49 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 05 2009 - 17:50:02 CEST