Nick van Eijndhoven wrote: > > Dear ROOTers, > I have a class derived from TObject and with ClassDef() and > ClassImp() to have the automatic ROOT I/O generated. > However, in the private area of that class I need to store > a char* data member. > This gives problems in the automatic streamer generation, so > I replaced the char* by TString* and in some member function > I initialise via > > s=new TString("test"); > > However, when compiling my class it turns out that there is > in the dictionary NO 'binary >>' defined which can handle a > TString* object on the right hand side. > This results in a compilation error (using msvc++ on win95 > with ROOT 2.00/07) and so I can't create my DLL. > > So I guess replacing TString* by TString in the private area > in my class will do the job. > Now my question is : Does there exist some TString member function > with which I can put some chararcter string into the object ? > (i.e. the reverse of TString::Data()) > What I need is : > > private : // the private area of my class > TString s; > > and then in the code of my member function : > > s.Enter("test"); // To enter the string "test" into s > > So far I could not find such a funtionality in the docs, so > as usual any good advice is very welcome. Nick, You should use TString test; as a recommended alternative to char *test; You set a TString simply with test = "Nick" There are plenty of examples with TString in Root itself. Have a look at TNamed. We also have a test example with all possible combinations to use TString in $ROOTSYS/test/tstring.cxx Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET