From b5681c0d341a957d4cfad1e6bd03175097112985 Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 21 Jul 2026 13:39:28 -0400 Subject: [PATCH] Set binary or text mode on stdout as well as stdin --- include/file.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/file.hpp b/include/file.hpp index 5d41f169..a400b7a7 100644 --- a/include/file.hpp +++ b/include/file.hpp @@ -34,6 +34,9 @@ public: } else { assume(mode & std::ios_base::out); _file.emplace(std::cout.rdbuf()); + if (setmode(STDOUT_FILENO, (mode & std::ios_base::binary) ? O_BINARY : O_TEXT) == -1) { + return nullptr; + } } return this; }