Clear the all set bit previously set by the stream...

...after closing the file
This commit is contained in:
Timotei Dolean 2011-09-05 18:50:56 +00:00
parent 02ad6c9dbc
commit e34ef4e8f4

View file

@ -316,6 +316,7 @@ bool class_source_parser::parse_source(){
// Item with will be at the end of error list.
return false;
}
f_.open(input_.c_str(),std::ios::in);
if (f_.fail()){
errors_.add_simple_error("File "+input_ + " can not be opened\n");
@ -326,6 +327,9 @@ bool class_source_parser::parse_source(){
while (!f_.eof()){
std::string line;
if (! getline(line) ) {
f_.close();
f_.clear();
close_opened_tags();
parent_name_.clear();
return false;
@ -338,7 +342,13 @@ bool class_source_parser::parse_source(){
}
}
}
f_.close();
// Clear all flags ( eg the eof flag ) after closing the file.
// This will let us reuse the same fstream variable for different files.
f_.clear();
close_opened_tags();
parent_name_.clear();
return result;