Difference between revisions of "CoreInterface PrintTitle Example"

From BRL-CAD
(New page: #include <iostream> #include <brlcad/ConstDatabase.h> int main ( int argc, char* argv[] ) { int ret = 0; if (argc < 2) { std::cout << "Usage: " ...)
 
m (BRLCAD::bad_alloc)
Line 26: Line 26:
 
             }
 
             }
 
         }
 
         }
         catch(std::bad_alloc e) {
+
         catch(BRLCAD::bad_alloc& e) {
 
             std::cout << "Out of memory in: " << e.what();
 
             std::cout << "Out of memory in: " << e.what();
 
             ret = 3;
 
             ret = 3;

Revision as of 06:15, 13 May 2009

#include <iostream>

#include <brlcad/ConstDatabase.h>


int main
(
    int   argc,
    char* argv[]
) {
    int ret = 0;

    if (argc < 2) {
        std::cout << "Usage: " << argv[0] << " <BRL-CAD Database>";
        ret = 1;
    }
    else {
        try {
            BRLCAD::ConstDatabase database;

            if (database.Load(argv[1]))
                std::cout << database.Title();
            else {
                std::cout << "Could not load file: " << argv[1];
                ret = 2;
            }
        }
        catch(BRLCAD::bad_alloc& e) {
            std::cout << "Out of memory in: " << e.what();
            ret = 3;
        }
    }

    return ret;
}