Hi Ashley, the buffer pointed at by "my" is not a printable character string but a binary string of given length. Cout char* stops printing at the first '\0' and "my" may contain many 0's. You should write this buffer as a binary file. But better is to use ROOT files to save session state. Cheers, Fons. On Thu, 2002-04-25 at 17:25, Ashley Cambrell wrote: > Hi All, > > I'm playing around with TBuffer to try and see how I might implement > sessions for Carrot and I can't seem to get the posted TBuffer example > to work > > [ref: > Re: [ROOT] TBuffer usage examples > From: Rene Brun > Date: Mon Apr 22 2002 - 22:43:35 MEST > ] > > $ root > ******************************************* > * * > * W E L C O M E to R O O T * > * * > * Version 3.02/07 18 April 2002 * > * * > * You are welcome to visit our Web site * > * http://root.cern.ch * > * * > ******************************************* > > Compiled for linux with thread support. > > CINT/ROOT C/C++ Interpreter version 5.15.25, Jan 6 2002 > Type ? for help. Commands must be C++ statements. > Enclose multiple statements between { } > root [0] TBuffer t(TBuffer::kWrite); > root [1] h1f= new TH1F("h1f","test",200,0,10); > root [2] h1f->Streamer(t); > root [3] char *my=t.Buffer(); > root [4] t.Length(); > root [5] cout << my << endl; > @ > root [6] cout << t.Length() << endl; > 1308 > root [7] > > Shouldn't cout << my << endl; output the buffer? What am I doing/got wrong? > > Thank you > > Ashley Cambrell > -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET