[ROOT] iostream

From: Dong Zhou (nosarthur@yahoo.com.cn)
Date: Mon Sep 29 2003 - 14:04:17 MEST


dear rooters:
 
i feel there is something wrong with the 'fin >>' method.
 
my code is like this:
// tmp.cpp
void tmp(){
ofstream fout ("tmp.dat");
Double_t arr;
 
for(int i=0;i<3;++i){
 fout << i*0.1;
}
fout.close();
ifstream fin("tmp.cpp");
for(i=0;i<3;++i){
 fin >> arr;
 cout << i << ' ' << arr << endl;
}
}
 
it should be 0 0.1 0.2
but the output turns out to be 0.1 0.2 0.2
it seems that it take 00.1 as 0.1
 
i am not sure if i have made any mistake. what is ur opinion?
thank u.
 
zhou, dong



---------------------------------
Do You Yahoo!?
启用电邮帐号,领会雅虎通[身临其境聊电影]的动感魅力,还有网络摄像头+雅虎通收音机等你来拿



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET