input parameters on C++ file to a global variable

I’d like to feed a global variable some external parameters.

My actual code is:

    static const char conn_str[] =
    "user='postgres' password='' host='127.0.0.1' port='5432' dbname='database'";

    pqxx::connection C(conn_str);
    pqxx::nontransaction N(C);

And I’d like to be able to feed the code with argv parameters and still using connection C as global.

Any thoughts?
thanks in advance…


Source: c++

Leave a Reply