Boost logo

Boost-Commit :

From: dwalker07_at_[hidden]
Date: 2008-06-30 11:44:16


Author: dlwalker
Date: 2008-06-30 11:44:16 EDT (Mon, 30 Jun 2008)
New Revision: 46918
URL: http://svn.boost.org/trac/boost/changeset/46918

Log:
Added simpler example program
Added:
   sandbox/md5/libs/coding/example/md5basic.cpp (contents, props changed)

Added: sandbox/md5/libs/coding/example/md5basic.cpp
==============================================================================
--- (empty file)
+++ sandbox/md5/libs/coding/example/md5basic.cpp 2008-06-30 11:44:16 EDT (Mon, 30 Jun 2008)
@@ -0,0 +1,44 @@
+// Boost MD5 simple example program file ------------------------------------//
+
+// (C) Copyright 2008 Daryle Walker. Distributed under the Boost Software
+// License, Version 1.0. (See the accompanying file LICENSE_1_0.txt or a copy
+// at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+// See <http://www.boost.org/libs/coding> for the library's home page.
+
+#include <boost/coding/md5.hpp> // for boost::coding::compute_md5
+
+#include <cstring> // for std::strlen
+#include <cstdlib> // for EXIT_SUCCESS, EXIT_FAILURE
+#include <exception> // for std::exception
+#include <iostream> // for std::cerr, cout
+#include <ostream> // for std::endl
+
+
+// Using declarations
+using std::cerr;
+using std::endl;
+
+
+// Program driver
+int
+main( int argc, char *argv[] )
+try
+{
+ // Check-sum each command-line string
+ for ( int i = 1 ; i < argc ; ++i )
+ std::cout << boost::coding::compute_md5( argv[i], std::strlen(argv[
+ i ]) ) << endl;
+
+ return EXIT_SUCCESS;
+}
+catch ( std::exception const &e )
+{
+ cerr << e.what() << endl;
+ return EXIT_FAILURE;
+}
+catch ( ... )
+{
+ cerr << "unknown problem" << endl;
+ return EXIT_FAILURE;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk