We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ce014e commit 373ae67Copy full SHA for 373ae67
include/sorters/sorter.hpp
@@ -69,15 +69,17 @@ struct sorter {
69
template <typename Iterator>
70
void flush(Iterator begin, Iterator end,
71
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);
+ std::ofstream os;
+ os.open(output_filename.c_str(),
+ std::ofstream::ate | std::ofstream::app);
75
76
if (LineHandler::value_t == value_type::count) {
77
+ uint64_t n = uint64_t(end - begin);
78
building_util::write(os, std::to_string(n));
79
os << '\n';
80
}
81
82
+ std::string line_to_write;
83
for (auto it = begin; it != end; ++it) {
84
LineHandler::format_line(*it, line_to_write);
85
building_util::write(os, line_to_write);
0 commit comments