☆─────────────────────────────────────☆
ruisher (aa) 于 (Sat Sep 10 00:05:17 2005) 提到:
I want to read in a file in c++, but the weird thing is that it will read in
the last line twice. What's wrong with this?
int main() {
ifstream data;
data.open ("test.txt");
while(data)
{
data>>x>>y>>z;
}
data.close();
return 0;
}
If the file contains
1.2 2.2 3.3
1.3 2.3 4.3
it will reads in
1.2 2.2 3.3
1.3 2.3 4.3
1.3 2.3