
2 Aug
2006
2 Aug
'06
10:42 p.m.
Hi! pktao@uwm.edu schrieb:
while ( !inputDataStream.eof() ) {
if ( (previousIterator + 3) == i) {
immobileWrite(i);
previousIterator = previousIterator + 3;
}
else {
dataStructureWrite(i);
};
i++;
};
I cannot see where data is read. Anyway: - first: Test for any error: "while(inputDataStream) {...}" - second: Test after read: int sum = 0, i; while(inputDataStream >> i) { sum +=i; } When using istream_iterator<T>, then just test against an end interator: std::for_each(istream_iterator<int>(inputDataStream), istream_iterator<int>(), &foo); All of the above is true for both boost::filesystem::basic_ifstream and std::ifstream. It is true for any std::istream. HTH, Frank