Hi Masahiro,
There are several functions of ifstream currently not accessible from
CINT.
Masa may want to comment on this.
You can run your test in the following way:
#include <string>
void sugaya() {
ifstream fi("test.dat");
//cout << fi.is_open() << endl;
string t;
fi >> t;
cout << t << endl;
}
Rene Brun
On Sun, 20 Jan 2002 sugayam@post.kek.jp wrote:
>
> Hi rooters,
> I have some problems using fstream in the root script.
>
> My root ver. is 3.02/07. linux redhat 6.1.
>
> The probrem is that next script test.C doesn't work well.
> -----test.C----------
> {
> ifstream fi("test.dat");
> cout << fi.is_open() << endl;
> string t;
> fi >> t;
> cout << t << endl;
> }
>
> The error output is
> root[1] .x test.C
> ==> ifstream::is_open () in current scope FILE:test.C LINE:3
> ==> Possible candidates are...
> ==> Possible candidates are...
> ==> filename line:size busy function type and name (in ifstream)
> ==> filename line:size busy function type and name (in fstreambase)
> ==> filename line:size busy function type and name (in ios)
> ==> filename line:size busy function type and name (in istream)
> ==> filename line:size busy function type and name (in ios)
> ==> *** Interpreter error recovered ***Possible candidates are...
> ==> filename line:size busy function type and name (in ifstream)
> ==> filename line:size busy function type and name (in fstreambase)
> ==> filename line:size busy function type and name (in ios)
> ==> filename line:size busy function type and name (in istream)
> ==> filename line:size busy function type and name (in ios)
> ==> *** Interpreter error recovered ***
>
> So I commented out the line of cout << fi.is_open() << endl;
> -----test.C----------
> {
> ifstream fi("test.dat");
> //cout << fi.is_open() << endl;
> string t;
> fi >> t;
> cout << t << endl;
> }
>
> but it said
>
> root[1] .x test.C
> ==> Error: Symbol i is not defined in current scope FILE:bstring.h LINE:2523
> ==> Error: Failed to evaluate i.operatorvoidError: Binary operator oprand missing FILE:bstring.h LINE:2523
> ==> *** Interpreter error recovered ***
>
>
> Masahiro Sugaya---------------------------
> Address: 1-1 Oho, Tsukuba, Ibaraki 305-0801 Japan
> Office: 0298-79-6123
> Mail: sugayam@post.kek.jp
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:39 MET