Re: Once again ifstreams (Version 1.03/09)

From: Masaharu Goto (gotom@hpyiddq.jpn.hp.com)
Date: Tue Feb 03 1998 - 02:36:43 MET


Martin,

 Your macro works on ROOT 1.03/09 - Windows-NT. 
 
 Fons,  any idea?  I wonder new/delete thing is doing someting here.
 I remember we discussed about Alpha speicific dictionary source code
 a couple of weeks ago. I might do something.

Masaharu Goto

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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:29 MET