tools: Use binary mode for output writing in ndngetfile
Change-Id: I1c7954517b65e81b1e0ab9d336a6c69d76390d17
Refs: #2296
diff --git a/tools/ndngetfile.cpp b/tools/ndngetfile.cpp
index db1b22b..99f54ca 100644
--- a/tools/ndngetfile.cpp
+++ b/tools/ndngetfile.cpp
@@ -290,12 +290,11 @@
if (outputFile != 0)
{
- of.open(outputFile);
- if (!of)
- {
- std::cerr << "ERROR: output file is invalid" << std::endl;
- return 1;
- }
+ of.open(outputFile, std::ios::out | std::ios::binary | std::ios::trunc);
+ if (!of || !of.is_open()) {
+ std::cerr << "ERROR: cannot open " << outputFile << std::endl;
+ return 1;
+ }
buf = of.rdbuf();
}
else