T
thomas
----------code----------
istream is(filename);
int i1,i2; string s3;
while(is>>i1>>i2>>s3){
...
}
--------code--------
The file "filename" should be formated as "int int string" for each
line,
but the last line may have only "int int" or even "int".
So the program encounter error when reading the last line.
It's supposed that I can remove the last line if it's mal-formated.
But the file is huge, opening it is time consuming.
Is there a convenient way to tell "istream" that " this line is not
formated as expected, you can stop here"?
istream is(filename);
int i1,i2; string s3;
while(is>>i1>>i2>>s3){
...
}
--------code--------
The file "filename" should be formated as "int int string" for each
line,
but the last line may have only "int int" or even "int".
So the program encounter error when reading the last line.
It's supposed that I can remove the last line if it's mal-formated.
But the file is huge, opening it is time consuming.
Is there a convenient way to tell "istream" that " this line is not
formated as expected, you can stop here"?