Re: cout

Fons Rademakers (Fons.Rademakers@cern.ch)
Tue, 09 Dec 1997 22:07:31 +0100


Hi Selim,

you should add the line
#include <iostream.h>
in your rootlogon.C macro file. All objects created
in this file will survive a gROOT.Reset(). That is
gROOT.Reset() will only wipe the symbols that have been
created after the startup macro has been executed.

Cheers, Fons.

Selim Issever wrote:
>
> Ok,.. but what about this:
>
> #include <iostream.h>
> void tt() {
> cout << "Ha Ha" << endl;
> gROOT->Reset();
> #include <iostream.h>
> cout << "Hi Hi" << endl;
> }
>
> gives me a:
> root [0] .x tt.C
> Ha Ha
> Warning: File "iostream.h" already loaded <------!?!?!?
> Error: No symbol cout in current scope
> FILE:/local1/issever/tacana/ex/./tt.C LINE:8
> Error: L Illegal operator for pointer 3
> FILE:/local1/issever/tacana/ex/./tt.C LINE:8
> Error: L Illegal operator for pointer 3
> FILE:/local1/issever/tacana/ex/./tt.C LINE:8
> NULL
> *** Interpreter error recovered ***
>
> I mean there was the advice to _have_ a gROOT->Reset(); at the
> beginning,.. *shrug*
>
> Best Regards
> Selim
>
> ]
> ] You don't want to reset EVERYTHING in the middle of your job:
> ]after gROOT->Reset() is called cint "forgets" about `cout'.
> ]
> ] Regards, Pasha.
> ]
> ]
> ]Selim Issever writes:
> ] > Dear all,
> ] >
> ] > I have the following piece of code, which is not working,..
> ] >
> ] > // This is an example for cout not working after a
> ] > // root routine was called,..
> ] > #include <iostream.h>
> ] > void tt() {
> ] > cout << "Ha Ha" << endl;
> ] > gROOT->Reset();
> ] > cout << "Hi Hi" << endl;
> ] > }
> ] >
> ] > 'Ha Ha' is printed,.. 'Hi Hi' not,..
> ] > Does anybody know whats wrong here?
> ] >
> ] > Best Regards
> ] > Selim
> ] >
>
> S E L I M I S S E V E R
> DESY-F15, Notkestr. 85, 22603 Hamburg, Germany; Tel/Fax: 040 8998-2843/4033
> http://www.physik.uni-dortmund.de/~issevers; selim.issever@desy.de
> Ete kemige burundum, Yunus diye gorundum. Yunus Emre

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910