From 76de66140226728fd22f1dfda976e7214d79a62c Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 15 Oct 2010 16:01:43 +0000 Subject: Use binary I/O where needed --- doc/examples/bzip.cpp | 4 ++-- doc/examples/cryptobox.cpp | 2 +- doc/examples/dsa_sign.cpp | 2 +- doc/examples/dsa_ver.cpp | 2 +- doc/examples/encrypt.cpp | 2 +- doc/examples/hash_quickly.cpp | 2 +- doc/examples/hasher.cpp | 2 +- doc/examples/hasher2.cpp | 2 +- doc/examples/package.cpp | 2 +- doc/examples/stack.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) (limited to 'doc/examples') diff --git a/doc/examples/bzip.cpp b/doc/examples/bzip.cpp index c3509c4da..6137bb6af 100644 --- a/doc/examples/bzip.cpp +++ b/doc/examples/bzip.cpp @@ -84,8 +84,8 @@ int main(int argc, char* argv[]) outfile = outfile.replace(outfile.find(SUFFIX), SUFFIX.length(), ""); - std::ifstream in(infile.c_str()); - std::ofstream out(outfile.c_str()); + std::ifstream in(infile.c_str(), std::ios::binary); + std::ofstream out(outfile.c_str(), std::ios::binary); if(!in) { std::cout << "ERROR: could not read " << infile << std::endl; diff --git a/doc/examples/cryptobox.cpp b/doc/examples/cryptobox.cpp index f45f00ca1..38d750d17 100644 --- a/doc/examples/cryptobox.cpp +++ b/doc/examples/cryptobox.cpp @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) std::string pass = argv[1]; std::string filename = argv[2]; - std::ifstream input(filename.c_str()); + std::ifstream input(filename.c_str(), std::ios::binary); std::vector file_contents; while(input.good()) diff --git a/doc/examples/dsa_sign.cpp b/doc/examples/dsa_sign.cpp index ea23907cf..5f02c0dc1 100644 --- a/doc/examples/dsa_sign.cpp +++ b/doc/examples/dsa_sign.cpp @@ -32,7 +32,7 @@ int main(int argc, char* argv[]) try { std::string passphrase(argv[3]); - std::ifstream message(argv[2]); + std::ifstream message(argv[2], std::ios::binary); if(!message) { std::cout << "Couldn't read the message file." << std::endl; diff --git a/doc/examples/dsa_ver.cpp b/doc/examples/dsa_ver.cpp index b30208559..a666259c1 100644 --- a/doc/examples/dsa_ver.cpp +++ b/doc/examples/dsa_ver.cpp @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) Botan::LibraryInitializer init; - std::ifstream message(argv[2]); + std::ifstream message(argv[2], std::ios::binary); if(!message) { std::cout << "Couldn't read the message file." << std::endl; diff --git a/doc/examples/encrypt.cpp b/doc/examples/encrypt.cpp index b5568ca50..8f53c85e3 100644 --- a/doc/examples/encrypt.cpp +++ b/doc/examples/encrypt.cpp @@ -96,7 +96,7 @@ int main(int argc, char* argv[]) return 1; } - std::ifstream in(filename.c_str()); + std::ifstream in(filename.c_str(), std::ios::binary); if(!in) { std::cout << "ERROR: couldn't open " << filename << std::endl; diff --git a/doc/examples/hash_quickly.cpp b/doc/examples/hash_quickly.cpp index bf6fe1d82..005a6d719 100644 --- a/doc/examples/hash_quickly.cpp +++ b/doc/examples/hash_quickly.cpp @@ -83,7 +83,7 @@ int main(int argc, char* argv[]) for(size_t i = 1; argv[i]; ++i) { - std::ifstream in(argv[i]); + std::ifstream in(argv[i], std::ios::binary); if(!in) continue; diff --git a/doc/examples/hasher.cpp b/doc/examples/hasher.cpp index f3f2ab874..e5c52ba55 100644 --- a/doc/examples/hasher.cpp +++ b/doc/examples/hasher.cpp @@ -35,7 +35,7 @@ int main(int argc, char* argv[]) Botan::Pipe pipe(new Botan::Fork(hash, COUNT)); - std::ifstream file(argv[j]); + std::ifstream file(argv[j], std::ios::binary); if(!file) { std::cout << "ERROR: could not open " << argv[j] << std::endl; diff --git a/doc/examples/hasher2.cpp b/doc/examples/hasher2.cpp index abbe11622..b6303b644 100644 --- a/doc/examples/hasher2.cpp +++ b/doc/examples/hasher2.cpp @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) new Botan::Hash_Filter(name[2]), }; - std::ifstream file(argv[j]); + std::ifstream file(argv[j], std::ios::binary); if(!file) { std::cout << "ERROR: could not open " << argv[j] << std::endl; diff --git a/doc/examples/package.cpp b/doc/examples/package.cpp index 38a2e1666..02cf52816 100644 --- a/doc/examples/package.cpp +++ b/doc/examples/package.cpp @@ -18,7 +18,7 @@ namespace { std::vector slurp_file(const std::string& filename) { - std::ifstream in(filename.c_str()); + std::ifstream in(filename.c_str(), std::ios::binary); std::vector out; byte buf[4096] = { 0 }; diff --git a/doc/examples/stack.cpp b/doc/examples/stack.cpp index f569004fc..0c00ed183 100644 --- a/doc/examples/stack.cpp +++ b/doc/examples/stack.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) int skipped = 0; for(int j = 1; argv[j] != 0; j++) { - std::ifstream file(argv[j]); + std::ifstream file(argv[j], std::ios::binary); if(!file) { std::cout << "ERROR: could not open " << argv[j] << std::endl; -- cgit v1.2.3