Answer the question
In order to leave comments, you need to log in
Is it possible to "embed" several large .txt files into an .exe?
Hello. I'm just starting to learn programming and faced such a seemingly simple task, but I can't find a way to solve it. You need to somehow embed the text files in the output .exe. The program is a WindowsForms form under the CLR (.net framework) in C++.
At the moment, for the project to work, it is necessary to throw four .txt files into the folder with the .exe file, which does not look quite aesthetically pleasing, especially considering that the size of these files in total exceeds the size of .exe . Simply rewriting the contents of these files into code is not suitable, because there is a need for frequent and convenient text editing, plus you will have to rethink and rewrite the mechanism of work.
In the code itself, there is a link to four .txt files, which are kind of dictionaries with one word per line. The total length of these files is somewhere around 80 thousand lines. Files are opened using std::ifstream, from which std::getline takes the desired line.
I understand that such an implementation is done through resources, but I absolutely do not understand anything about this, because. Haven't looked into resources yet. Plus, many types of resources, their processing and other things create problems for orientation in all this. I will definitely study this topic, but it confuses me that all the code, in fact, was written in 10 minutes, and for the "finishing touch" I will need to study a huge amount of documentation.
I googled that it is somehow possible to convert these files into one of the resource file types using resgen.exe, but after each text file editing, manually converting the file and overwriting the existing one is a laborious task. Plus, it's not clear to me how to get it all from the resource files later.
It seems to me that all this can be done much more simply, which, in fact, is the essence of the question: Is it possible somehow at the compilation stage to simply copy the contents of these files into some "Virtual / Internal" files that ifstream can refer to, or something similar to it? Or just make sure that the .exe unpacks some kind of temporary files for the duration of the program?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question