File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,13 @@ process_three_types(const double alpha,
381381 ifstream o_in (oxbs_file);
382382 if (!o_in) throw dnmt_error (" failed to open input file: " + oxbs_file);
383383
384- ofstream out (outfile);
384+ ofstream of;
385+ if (!outfile.empty ()) {
386+ of.open (outfile);
387+ if (!of) throw dnmt_error (" failed to open output file: " + outfile);
388+ }
389+ std::ostream out (outfile.empty () ? cout.rdbuf () : of.rdbuf ());
390+
385391 ofstream out_m, out_h;
386392 if (!out_methcount_pseudo_m.empty ()) {
387393 out_m.open (out_methcount_pseudo_m);
@@ -557,7 +563,13 @@ process_two_types(const double alpha,
557563 size_t &conflict_sites) {
558564 constexpr auto max_read_count = 500 ;
559565
560- ofstream out (outfile);
566+ ofstream of;
567+ if (!outfile.empty ()) {
568+ of.open (outfile);
569+ if (!of) throw dnmt_error (" failed to open output file: " + outfile);
570+ }
571+ std::ostream out (outfile.empty () ? cout.rdbuf () : of.rdbuf ());
572+
561573 ofstream out_m, out_h;
562574 if (!out_methcount_pseudo_m.empty ()) {
563575 out_m.open (out_methcount_pseudo_m);
You can’t perform that action at this time.
0 commit comments