Iomanip in ROOT

Hi,

I have a code which use [color=red]iomanip[/color]. It runs fine if I compile with g++ but it shows error massage under root. The code is:

[color=blue]
#include
#include
#include

using namespace std;

void fill()
{
ifstream in(“test.dat”);
int x, y, z;

h1 = new TH2F(“x~y”,“x~y”,100,0.,1000.,100,0.,300.);
h2 = new TH2F(“x~z”,“x~z”,100,0.,40.,100,0.,300.);
h3 = new TH1F(“z”,“z”,100,0.,1000.);

while(in >> setw(10) >> x >> setw(10) >> y >> setw(10) >> z){
c1->cd();
h1->Fill(x,y);
c2->cd();
h2->Fill(x,z);
c3->cd();
h3->Fill(z);}

in.close();
}
[/color]

The error is:
[color=red]Error: operator>> not defined for basic_ifstream<char,char_traits > FILE:fill.C LINE:16
Error: Binary operator oprand missing FILE:fill.C LINE:16
Error: Binary operator oprand missing FILE:fill.C LINE:16
*** Interpreter error recovered ***
[/color]

I have produced the data file “test.dat” by running the program under root with same format as shown in “while” loop, line 16. But at reading time it shows the problem. The problem is with “setw(10)”. However, it works if I give simply “in >> x >> y >> z”. But I am curious.

This program works fine if I compile with g++ after removing the h1,h2,h3 and fill() lines like:

[color=purple]
#include
#include
#include

using namespace std;

main()
{
ifstream in(“test.dat”);
int x, y, z;

while(in >> setw(10) >> x >> setw(10) >> y >> setw(10) >> z){
cout << setw(10) << x << setw(10) << y << setw(10) << z << endl;}

in.close();
}
[/color]

Could you please tell me why “iomanip” is different in ROOT and how to do this.
Thank you very much.