Added explicit calls to fstream::close rather than relying on destructors as a tentative gcc-cygwin fix.

[SVN r21287]
This commit is contained in:
John Maddock
2003-12-16 13:05:22 +00:00
parent 7858e47a26
commit 2c3ff62e1b
12 changed files with 18 additions and 0 deletions

View File

@ -79,6 +79,7 @@ int main(int argc, char* argv[])
std::ifstream fs(argv[i]);
if(fs.bad()) continue;
search(fs);
fs.close();
}
}
else

View File

@ -105,6 +105,7 @@ int main(int argc, const char** argv)
map_type m;
std::ifstream fs(argv[i]);
load_file(text, fs);
fs.close();
IndexClasses(m, text);
cout << m.size() << " matches found" << endl;
map_type::iterator c, d;

View File

@ -101,6 +101,7 @@ int main(int argc, const char** argv)
cout << "Processing file " << argv[i] << endl;
std::ifstream fs(argv[i]);
load_file(text, fs);
fs.close();
IndexClasses(text);
cout << class_index.size() << " matches found" << endl;
map_type::iterator c, d;

View File

@ -124,6 +124,7 @@ int main(int argc, const char** argv)
cout << "Processing file " << argv[i] << endl;
std::ifstream fs(argv[i]);
load_file(text, fs);
fs.close();
class_index idx;
idx.IndexClasses(text);
cout << idx.get_map().size() << " matches found" << endl;

View File

@ -123,6 +123,7 @@ int main(int argc, const char** argv)
cout << "Processing file " << argv[i] << endl;
std::ifstream fs(argv[i]);
load_file(text, fs);
fs.close();
class_index i;
i.IndexClasses(text);
cout << i.get_map().size() << " matches found" << endl;

View File

@ -89,6 +89,7 @@ int main(int argc, const char** argv)
cout << "Processing file " << argv[i] << endl;
std::ifstream fs(argv[i]);
load_file(text, fs);
fs.close();
// construct our iterators:
boost::sregex_iterator m1(text.begin(), text.end(), expression);
boost::sregex_iterator m2;

View File

@ -62,6 +62,7 @@ int main(int argc, const char** argv)
std::ifstream fs(argv[i]);
std::string in;
load_file(in, fs);
fs.close();
std::string out_name = std::string(argv[i]) + std::string(".htm");
std::ofstream os(out_name.c_str());
os << header_text;
@ -76,6 +77,7 @@ int main(int argc, const char** argv)
std::ostream_iterator<char> out(os);
boost::regex_merge(out, s.begin(), s.end(), e1, format_string, boost::match_default | boost::format_all);
os << footer_text;
os.close();
}
}
catch(...)

View File

@ -62,6 +62,7 @@ int main(int argc, const char** argv)
std::ifstream fs(argv[i]);
std::string in;
load_file(in, fs);
fs.close();
std::string out_name = std::string(argv[i]) + std::string(".htm");
std::ofstream os(out_name.c_str());
os << header_text;
@ -76,6 +77,7 @@ int main(int argc, const char** argv)
std::ostream_iterator<char> out(os);
boost::regex_replace(out, s.begin(), s.end(), e1, format_string, boost::match_default | boost::format_all);
os << footer_text;
os.close();
}
}
catch(...)

View File

@ -103,6 +103,7 @@ int main(int argc, const char** argv)
map_type m;
std::ifstream fs(argv[i]);
load_file(text, fs);
fs.close();
IndexClasses(m, text);
cout << m.size() << " matches found" << endl;
map_type::iterator c, d;

View File

@ -55,6 +55,7 @@ int main(int argc, char** argv)
s.erase();
std::ifstream is(argv[i]);
load_file(s, is);
is.close();
boost::regex_split(std::back_inserter(l), s, e);
while(l.size())
{
@ -74,6 +75,7 @@ int main(int argc, char** argv)
s.erase();
std::ifstream is(argv[i]);
load_file(s, is);
is.close();
while(boost::regex_split(std::ostream_iterator<std::string>(std::cout), s, e, boost::match_default, 1)) std::cout << std::endl;
}

View File

@ -53,6 +53,7 @@ int main(int argc, char** argv)
s.erase();
std::ifstream is(argv[i]);
load_file(s, is);
is.close();
boost::sregex_token_iterator i(s.begin(), s.end(), e, 1);
boost::sregex_token_iterator j;
while(i != j)
@ -71,6 +72,7 @@ int main(int argc, char** argv)
s.erase();
std::ifstream is(argv[i]);
load_file(s, is);
is.close();
const int subs[] = {1, 0,};
boost::sregex_token_iterator i(s.begin(), s.end(), e, subs);
boost::sregex_token_iterator j;

View File

@ -359,7 +359,10 @@ int main(int argc, char**argv)
}
if(pbuf)
{
cin.rdbuf(pbuf);
ifs.close();
}
return 0;
}