aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/base.cpp')
-rw-r--r--doc/examples/base.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/examples/base.cpp b/doc/examples/base.cpp
new file mode 100644
index 000000000..5a1328ccf
--- /dev/null
+++ b/doc/examples/base.cpp
@@ -0,0 +1,30 @@
+/*
+ A simple template for Botan applications, showing startup, etc
+*/
+#include <botan/botan.h>
+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
+#endif
+*/
+
+#include <iostream>
+
+int main()
+ {
+ try {
+ /* Put it inside the try block so exceptions at startup/shutdown will
+ get caught.
+ */
+ LibraryInitializer init;
+ }
+ catch(std::exception& e)
+ {
+ std::cout << e.what() << std::endl;
+ return 1;
+ }
+ return 0;
+ }