streams with CInt

From: William J. Deninger (deninger@uiuc.edu)
Date: Wed Oct 01 1997 - 23:22:35 MEST


Hello,

I've been having some trouble with file streams crashing root on my
WinNT workstation when they're loaded into the CInt interpreter and
called.  For example

file test.cpp
---------------------
class test
{
public:
    test() {};
    void openit(char *filename);
};

#include <fstream.h>
void test::openit(char *filename)
{
ifstream mystream;
mystream.open(filename);
};
----------------------
root [0] .L test.cpp;
root [1] test mytest;
root [2] mytest.openit("some_junk_file.txt");
       --->MessageBox appears with
! root.exe - Application Error
! X The instruction at "0x002bc5ed" referenced memory at 0xffffffff,
The memory
!   could not be "read".

Also, I'm confused about the following error.

file test.cpp
---------------------
class track
{
public:
float x;
float y;
};

class test
{
public:
    test();
    void openit(char *filename);
    track returnit(float xa, float xb);
};

#include <fstream.h>
void test::openit(char *filename)
{
ifstream mystream;
mystream.open(filename);
}
trace returnit(float xa, float xb)
{
track t;  t.x = xa; t.y = xb;
return t;
}
--------------------
file maintest.cpp
--------------------
{
test mytest;
track mytrack;
mytrack = mytest.returnit(5,6);
}

root [0] .L test.cpp;
root [1] .L maintest.cpp;
Error: class,struct,union or type unknown not defined  FILE.maintest.cpp
LINE:4

*** Interpreter error recovered ***

The following, however, does work.

root [0] .L test.cpp
root [1] test mytest;
root [2] track mytrack;
root [3] mytrack = mytest.returnit(5,6);

Does anyone have any suggestions? Do I need to compile these with MSVC
and link to ROOT instread? What am I not reading in the root http pages
which would help me stand on my own roots? I really dislike bothering
people with my programming difficulties.

William J. Deninger
deninger@uiuc.edu



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