Is it possible to create a Sqlite database file using C++?I've googled this to death and can't find a thing.
I can only create Sqlite tables using C++.

Thanks.

3

Best Answer


From the reference:

SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
The database is opened for reading and writing, and is created if it does >not already exist. This is the behavior that is always used for sqlite3_open() and sqlite3_open16().

So if you are using sqlite3_open this is automatic; if you are using sqlite3_open_v2 you have to include those flags.

sqlite3_open() will create the database for you, if the file does not already exist.

You can see this tutorial

You can see an introduction of Sqlite C/C++ interface here.

hope it helps.