Once again ifstreams (Version 1.03/09)

martin braeuer (Martin.Braeuer@mpi-hd.mpg.de)
Mon, 2 Feb 1998 22:44:18 +0100 (MET)


Hallo Rooters,
with the Version 1.03 /09 I have some nasty (newbee?) problems :

1. the macro :

// ------------------------------------
int prod()
{
ifstream datfile("test2.ve");
return 0;
}
//-------------------------------------

produces :

Fatal in <operator delete>: storage area overwritten
aborting
IOT/Abort trap (core dumped)

on Alpha and other systems (Irix and Linux) give nearly the same result.

using a new construct works until one tries to read the file :

//--------- Prod.C --------------
int prod()
{
ifstream* df = new ifstream("ein.ve");
Float_t x;

df >> x;
return 0;
}
//-------------------------------------

used in the root :

root [10] .! more ein.ve
1 2.3 4.5
1 2.31 4.5
1 2.32 4.5
1 2.34 3.5
1 2.35 4.45
1 2.32 4.5
1 2.34 3.5
1 2.35 4.45
root [11] .x prod.C()
!!! 0 object(s) deleted by Garbage Collection !!!
Error: R Illegal operator for real number
FILE:/d25/herab/users/braeuer/laser98/./prod.C LINE:6
(class ifstream*)0x1406b5a00
*** Interpreter error recovered ***
root [12]
//--------------------------------------------

On the other hand the ">>"works while using the first version shown above,
which sends root to hell when leaving the function.

What do I miss ?
Thaks for your help,
Greetings Martin

/----------------------------------------------------------------\
| Martin Braeuer |
| DESY -F15- (bldg. 66 r. 11) MPI fuer Kernphysik |
| Notkestrasse 85 Saupfercheckweg 1, Postf. 103980 |
| 22603 Hamburg 69029 Heidelberg |
| braeuer@desy.de braeuer@eu1.mpi-hd.mpg.de |
| tel.: +49 40 8998 4680 tel.: +49 6221 516 506 |
| +49 171 4580494 |
\----------------------------------------------------------------/