> > Kevin, > > What I have been doing is following > { > gROOT->Reset(); > TObjString *Avars[23] = { "Total", "Debrems", "Dedelta", "Deelse", > "Deepair", "Demunu", "Demuon", "Costhmu", > "Deelse", "Ener", "Gmtns", "Gmtsec", "Id", > "Ievent", "Nch", "Nhits", "Nstr", "Ntr", > "Phimu", "Toff","Trigg", "Vmu", "Zmu" }; > > // TString temp = Avars[0].GetString(); > // cout << temp.Data() << endl; > > Char_t temp[16]; > Int_t ii = 0; > sprintf(temp, "%s", Avar[ii]); > cout << temp << endl; > } This 'solution' only works in CINT because the sprintf statement treats Avar[ii] as a pointer to char, which (as I pointed out in my last mail) is what it in fact is, though it's not what it's declared to be -- a pointer to a TObjString. If you try to compile this code, it will probably (somewhat depending on which compiler you use) give you some gobbledygook at the head of each string, though it will (in good ol'fashioned C-style) let you shoot yourself in the foot with the sprintf. George Heintzelman gah@bnl.gov
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET