Re: cout

Masaharu Goto (gotom@hpyiddq.jpn.hp.com)
Wed, 10 Dec 1997 8:53:23 JST


Hello,

Quick work-around for you.

#include <iostream.h>
void tt() {
cout << "Ha Ha" << endl;
gROOT->Reset();
G__loadfile("iostream.h"); // use CINT API G__loadfile
cout << "Hi Hi" << endl;
}

#include does not work within a function. Cint provides G__loadfile() API
which does the same as #include.

But ROOT system has rules beyond raw cint. Fons, Do you recommend above
code or do you provide other means of doing this?

Masaharu Goto

>
> 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
>
>