Re: TString question

Nick van Eijndhoven (Nick@fys.ruu.nl)
Sun, 15 Mar 1998 16:25:39 +0100 (MET)


*** Radovan Chytracek wrote :
>
> On Sun, 15 Mar 1998, Nick van Eijndhoven wrote:
>
> >
> > TString* s; // In the private area of my class
> >
> > s = new TString("small_test"); // In one of the initialisation
> > // member functions
> >
> > char* ch=s->Data(); // In another member function.
> >
> > However, the last statement gives me an error message in ROOT
> >
> > "illegal pointer to class object".
> >
> > I also tried : char* ch=(char*)s->Data();
> > char* ch=(const char*)s->Data();
> >
> > but nothing worked.
>
> May be the following scenario will work:
>
> class MyClass {
>
> private:
>
> TString *s;
> ...
>
> public:
>
> char *GetData()
> {
> return( s->Data() );
> {
> ...
> };
>
> Use it as:
>
> MyClass mcls;
>
> char *ch = mcls.GetData();
>
> Happy ROOTing
>
> Radovan
>
>
>
Hi Radovan,
Since I need the TString contents in char* format in a member function
of the same class (in which then I use the char* as an argument for the
invokation of a member function of another class) the above construction
should not be needed according to standard C++.
So to me it seems we have some sort of CINT problem here.

Any idea Masa ????

Cheers,
_/_/ _/ _/ _/_/_/_/ _/ _/
_/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/_/
_/ _/_/ _/ _/ _/ _/
_/ _/ _/ _/_/_/_/ _/ _/

*----------------------------------------------------------------------*
Dr. Nick van Eijndhoven Department of Subatomic Physics
email : nick@fys.ruu.nl Utrecht University / NIKHEF
tel. +31-30-2532331 (direct) P.O. Box 80.000
tel. +31-30-2531492 (secr.) NL-3508 TA Utrecht
fax. +31-30-2518689 The Netherlands
WWW : http://www.fys.ruu.nl/~nick Office : Ornstein lab. 172
----------------------------------------------------------------------
tel. +41-22-7679751 (direct) CERN PPE Division / ALICE exp.
tel. +41-22-7675857 (secr.) CH-1211 Geneva 23
fax. +41-22-7679480 Switzerland
CERN beep : 13+7294 Office : B 160 1-012
*----------------------------------------------------------------------*