[C++] sqlite3_open() double-pointer passing.
I'm sorta new at C++, and I'm trying to use it more in favor of other languages since it's so ubiquitous. Right now I'm trying to parse a text file and dump information into a SQLite Database for later querying.
Where I'm running into a problem is that the sqlite3_open() statement seems to take a double pointer to a sqlite3 object. I'm not entirely familiar with how to use pointers in the first place, so I've been tweaking around with code to desperately make it just work.
I've finally gotten it to compile, but I feel like something about this is wrong. The arguments, according to documentation, for the sqlite3_open() function are sqlite3_open(const char *filename, sqlite3 **ppDb);. And this is what I finally got to work. Is this how it should be done, or am I missing something?
sqlite3 *db;
sqlite3_open(DB_NAME, &db);
Thanks for any help.
7 comments · 100% upvoted · other discussions
no that's fine, in terms of types
if you replace T with your type (T=sqlite3*)