Originally Posted by
darren78
...Does that part basically mean, get the data from the stream and if it fails, break?
Thanks.
That is exactly what it does. Take this code:
Code:
if(!(is >> m)) break;
Now let's break it into separate lines:
Code:
istream& file = is >> m; // The >> operator returns the stream itself, is.
if (!file) break; // If we were unable to extract the data from the file into m, the file will be marked as "bad".
This is also essentially the same as
Code:
is >> m;
if (!is) break;
The is >> m extracts the month from the file, if there is one. We know that because m is a month.