aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-10-07 23:54:10 +0000
committerlloyd <[email protected]>2007-10-07 23:54:10 +0000
commit6d745f8e2b5bb0089dbc58a7871adc29a1c0fac6 (patch)
treeadfbdf39c0d5acbb9331d28fae1b27b4ba84d7fa
parent47fec89661791a34ae2793a24503e18736a52c47 (diff)
Optionally, you can specify an argument that is passed to the LibraryInitializer
constructor.
-rw-r--r--doc/examples/base.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/doc/examples/base.cpp b/doc/examples/base.cpp
index 5a1328ccf..b81daa410 100644
--- a/doc/examples/base.cpp
+++ b/doc/examples/base.cpp
@@ -5,21 +5,33 @@
using namespace Botan;
/* This is how you can do compile-time version checking */
-/*
-#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,3,9)
- #error Your Botan installation is too old; upgrade to 1.3.9 or later
+
+#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,6,3)
+ #error Your Botan installation is too old; upgrade to 1.6.3 or later
#endif
-*/
#include <iostream>
-int main()
+int main(int argc, char* argv[])
{
- try {
+ try
+ {
/* Put it inside the try block so exceptions at startup/shutdown will
get caught.
+
+ It will be initialized with default options
*/
- LibraryInitializer init;
+
+ if(argc > 2)
+ {
+ std::cout << "Usage: " << argv[0] << "[initializer args]\n";
+ return 2;
+ }
+
+ std::string args = (argc == 2) ? argv[1] : "";
+
+ LibraryInitializer init(args);
+ // your operations here
}
catch(std::exception& e)
{