From 69cd8079da89fd31450325effa83420bf5d90904 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 29 Dec 2020 08:36:46 +1000 Subject: [PATCH] analyse: delay output file creation until after chunk discovery --- tools/analyse.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/analyse.cpp b/tools/analyse.cpp index efb84b4..c2ea8fa 100644 --- a/tools/analyse.cpp +++ b/tools/analyse.cpp @@ -192,9 +192,6 @@ int main (int argc, char const **argv) std::cerr << p << '\n'; - std::ofstream output (argv[ARGS_OUTPUT], std::ios::out | std::ios::trunc); - output.exceptions (std::ios::badbit | std::ios::eofbit | std::ios::failbit); - // Find all the chunks and prepare them for output std::cout << "processing\n"; std::vector src = find_chunks (argv[ARGS_INPUT], p); @@ -203,6 +200,8 @@ int main (int argc, char const **argv) std::sort (src.begin (), src.end (), region_less); // Write all chunks to the output file + std::ofstream output (argv[ARGS_OUTPUT], std::ios::out | std::ios::trunc); + output.exceptions (std::ios::badbit | std::ios::eofbit | std::ios::failbit); output << "params: " << p << '\n'; for (auto const &chunk: src) { output << chunk.size() << ' ';