Skip to content

Commit 373ae67

Browse files
committed
minor fix to include/sorters/sorter.hpp: append to file
1 parent 1ce014e commit 373ae67

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/sorters/sorter.hpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ struct sorter {
6969
template <typename Iterator>
7070
void flush(Iterator begin, Iterator end,
7171
std::string const& output_filename) {
72-
std::ofstream os(output_filename.c_str());
73-
std::string line_to_write;
74-
uint64_t n = uint64_t(end - begin);
72+
std::ofstream os;
73+
os.open(output_filename.c_str(),
74+
std::ofstream::ate | std::ofstream::app);
7575

7676
if (LineHandler::value_t == value_type::count) {
77+
uint64_t n = uint64_t(end - begin);
7778
building_util::write(os, std::to_string(n));
7879
os << '\n';
7980
}
8081

82+
std::string line_to_write;
8183
for (auto it = begin; it != end; ++it) {
8284
LineHandler::format_line(*it, line_to_write);
8385
building_util::write(os, line_to_write);

0 commit comments

Comments
 (0)