Open-RJ C/C++ User's Journal Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

example_cpp_4.cpp

C++ example program for the Open-RJ/C++ mapping. Demonstrates handling of a "failure to open file" error.

00001 /* /////////////////////////////////////////////////////////////////////////////
00002  * File:        example_cpp_4.cpp
00003  *
00004  * Purpose:     C++ example program for the Open-RJ/C++ mapping. Demonstrates
00005  *              handling of a "failure to open file" error.
00006  *
00007  * Created:     12th May 2006
00008  * Updated:     28th May 2006
00009  *
00010  * www:         http://www.openrj.org/
00011  *
00012  * License:     Copyright (c) 2006, Synesis Software Pty Ltd.
00013  *              All rights reserved.
00014  *
00015  *              (Licensed under the Synesis Software Open License)
00016  *
00017  *              This source code is placed into the public domain 2006
00018  *              by Synesis Software Pty Ltd. There are no restrictions
00019  *              whatsoever to your use of the software.
00020  *
00021  * ////////////////////////////////////////////////////////////////////////// */
00022 
00023 
00024 /* Open-RJ Header Files */
00025 #include <openrj/cpp/database.hpp>
00026 
00027 /* Standard C++ Library Files */
00028 #include <iostream>
00029 
00030 /* /////////////////////////////////////////////////////////////////////////////
00031  * Namespace
00032  */
00033 
00034 using std::cerr;
00035 using std::endl;
00036 using std::cout;
00037 
00038 /* ////////////////////////////////////////////////////////////////////////// */
00039 
00040 int main()
00041 {
00042     try
00043     {
00044         unsigned                    flags   =   0;  // No special flags here.
00045         openrj::cpp::FileDatabase   db("|i|n|v|a|l|i|d|n|a|m|e|", flags);
00046 
00047     }
00048     catch(std::exception &x)
00049     {
00050         cerr << "Failed to open database: " << x.what() << endl;
00051 
00052         return EXIT_FAILURE;
00053     }
00054 
00055     return EXIT_SUCCESS;
00056 }
00057 
00058 /* /////////////////////////////////////////////////////////////////////////////
00059  * end of file
00060  */

Open-RJ Library documentation © Synesis Software Pty Ltd, 2004-2005