lundi 20 mai 2019

How to get and std::ifstream object from a FILE* one

I'm trying to refactor some code/libraries by trying to embed some resource files as binary objects using the objcopy tool. The files are .txt and .xml.

The original library contains some file read/write code, based on fopen, which I replaced by fmemopen() in order to load the files from memory instead of getting them from the disk.

My issue is that, the library also contains some std::ifstream objects that are used to read some other files from disk, and my question is how can I read those too from the memory?

I.e. I need either to assign a FILE* to an ifstream somehow, or if there is an equivalent of fmemopen()that is used for ifstreams.

std::ifstream input(pathToFilters);

Thanks!

Aucun commentaire:

Enregistrer un commentaire