From c4e026daf4f22481d20c6f63d76ad23d5b65af45 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 2 Aug 2007 14:40:56 -0400 Subject: Output: Make OutputDirectory::create() be able to create binary files. --HG-- extra : convert_revision : eae114ee5f27bb8b319df705d9b39bded185b8e8 --- src/base/output.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/base/output.cc') diff --git a/src/base/output.cc b/src/base/output.cc index afcac03a5..9d02a4a71 100644 --- a/src/base/output.cc +++ b/src/base/output.cc @@ -87,7 +87,7 @@ OutputDirectory::resolve(const string &name) } ostream * -OutputDirectory::create(const string &name) +OutputDirectory::create(const string &name, bool binary) { if (name == "cerr" || name == "stderr") return &cerr; @@ -95,7 +95,8 @@ OutputDirectory::create(const string &name) if (name == "cout" || name == "stdout") return &cout; - ofstream *file = new ofstream(resolve(name).c_str(), ios::trunc); + ofstream *file = new ofstream(resolve(name).c_str(), + ios::trunc | binary ? ios::binary : (ios::openmode)0); if (!file->is_open()) panic("Cannot open file %s", name); -- cgit v1.2.3