Clear the all set bit previously set by the stream...
...after closing the file
This commit is contained in:
parent
02ad6c9dbc
commit
e34ef4e8f4
1 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue