Hi, you have to use it like this: root [0] TString str("Hello") root [1] TString s = str(0,4) root [2] s.Data() (const char* 0x8959244)"Hell" TSubString::Data() returns just the beginning of the string but we cannot add a terminating 0 at the substring end. Cheers, Fons. On Wed, 2003-10-22 at 15:06, Stanislav Nesterov wrote: > Dear Fons, > I've found strange behaviour of the TSubString::Data() function: it > doesn't use the TSubString::fExtent variable to return a char* > representation of SubString. So for example: > > root [0] TString str("Hello"); > root [1] str(0,4).Data() > (const char* 0x89287dc)"Hello" > > instead of "Hell" > > It is because of > > inline const char* TSubString::Data() const > { return fStr->Data() + fBegin; } > > where only pointer to the whole string is returned. > I am not sure about workaround, so can you please fix it? > > Best -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://www.rademakers.org/fons/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET