aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-07-07 18:27:45 +0000
committerlloyd <[email protected]>2010-07-07 18:27:45 +0000
commit61734fa2696ff73c213d8e801a786e538258df8e (patch)
tree387e96c4d56e094bcc75df77d61d3315d42b9afa
parented7fca61ada917361c481d1119a670cf48292d57 (diff)
Read and save the files in binary mode to avoid weird EOF problems
on Windows.
-rw-r--r--doc/examples/rsa_dec.cpp2
-rw-r--r--doc/examples/rsa_enc.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/doc/examples/rsa_dec.cpp b/doc/examples/rsa_dec.cpp
index 8353b0449..81592328c 100644
--- a/doc/examples/rsa_dec.cpp
+++ b/doc/examples/rsa_dec.cpp
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
std::string outfile(argv[2]);
outfile = outfile.replace(outfile.find(SUFFIX), SUFFIX.length(), "");
- std::ofstream plaintext(outfile.c_str());
+ std::ofstream plaintext(outfile.c_str(), std::ios::binary);
if(!plaintext)
{
std::cout << "Couldn't write the plaintext to "
diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp
index 6cf555e70..b21b60a5d 100644
--- a/doc/examples/rsa_enc.cpp
+++ b/doc/examples/rsa_enc.cpp
@@ -47,7 +47,7 @@ int main(int argc, char* argv[])
return 1;
}
- 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;