mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
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
This commit is contained in:
@@ -95,6 +95,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// Figure out what stream we are supposed to write to...
|
||||
// FIXME: cout is not binary!
|
||||
std::ostream *Out = &std::cout; // Default to printing to stdout...
|
||||
if (OutputFilename != "-") {
|
||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||
@@ -104,7 +105,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";
|
||||
@@ -117,8 +120,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// If the output is set to be emitted to standard out, and standard out is a
|
||||
// console, print out a warning message and refuse to do it. We don't impress
|
||||
// anyone by spewing tons of binary goo to a terminal.
|
||||
// console, print out a warning message and refuse to do it. We don't
|
||||
// impress anyone by spewing tons of binary goo to a terminal.
|
||||
if (!Force && !NoOutput && CheckBytecodeOutputToConsole(Out,!Quiet)) {
|
||||
NoOutput = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user