void test()
{
ifstream time("time.txt");
if(time)
{
while(!time.eof())
{
int id;
char ig;
int hour;
int min;
time >>id;
time.get();
time >> hour;
time.get();
time >> min;
time.get();
ig = time.get();
ig = time.get();
cout << id <<endl;
}
}
}
输入文件的内容是这样的:
1, 10:26, I
2, 10:00, I
3, 9:00, I
2, 11:30, o
3, 13:00, o
1, 14:30, o
为什么最后一行被读了两遍?这个文件输入流的执行过程是怎么样啊?