From 5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Sat, 22 Jan 2005 17:36:17 +0000 Subject: Use binary mode for reading/writing bytecode files git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19751 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-link/llvm-link.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/llvm-link') diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index a32b884..16e882e 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -112,6 +112,7 @@ int main(int argc, char **argv) { if (DumpAsm) std::cerr << "Here's the assembly:\n" << Composite.get(); + // FIXME: cout is not binary! std::ostream *Out = &std::cout; // Default to printing to stdout... if (OutputFilename != "-") { if (!Force && std::ifstream(OutputFilename.c_str())) { @@ -121,7 +122,9 @@ int main(int argc, char **argv) { << "Use -f command line argument to force output\n"; return 1; } - Out = new std::ofstream(OutputFilename.c_str()); + std::ios::openmode io_mode = std::ios::out | std::ios::trunc | + std::ios::binary; + Out = new std::ofstream(OutputFilename.c_str(), io_mode); if (!Out->good()) { std::cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n"; return 1; -- cgit v1.1