jeudi 22 juillet 2021

Embed sqlite database into c++ executable

I think my question is related to this one, but that one is talking about a png and I'm not sure how to translate that to my case.

I have a database created with sqlite in a file ending with .db. Now I have a program that only reads from this database. Is there a way to include the databse file into the executable?

Now if I compile I have to keep the executable and file together. This dependency could be removed by having the database file at an absolute path, but I'm also working on hpc clusters so that doesn't work. I need a relative path such that the db file is at the same hierarchy as my main.cpp but I want to be able to copy the execuatably without coping the db file, so in some way the db file is already part of the executable.

Aucun commentaire:

Enregistrer un commentaire