Embed resource in executable and use as not embedded (by filename) (c++)

  c++, embedded-resource

As the title suggests I want to embedded a resource (a sqlite3 database which is small, max 10 MB in dumped sql). There are numerous questions with answers about this but I’m missing some part to make it working for me.

Some solutions that I have seen are: here, here and here. Want I understand from these answers is that in your code you can access the memory/data based on a start iterator and end iterator. However I want to open my file like I would usually do with just giving the filename (like fopen ( const char * filename, const char * mode ) and in my actual case int sqlite3_open( const char *filename, sqlite3 **ppDb )). I have worked with qt before and there I remember I could have resources embedded but could still use them with their name as usual (like in this anwser).
From what I understand windows also has something like that. But I’m (mostly) on linux and don’t want to use qt.

Question: Are there other solutions (next to qt/windows) to embedd a file and being able to use it with just the filename, just like I would use it if it was not an embedded file?

I’m using cmake (and c++17) btw so I would prefer answer that take that into account.

Source: Windows Questions C++

LEAVE A COMMENT