I have a Win32 Application in C++. At runtime, It loads a Matrix stored as TXT file in the working directory with I/O functions.

I have problems to distribute my program (EXE and DLL) because people normally forget to move the text files together with the Application.

How can I embed this TXT file into the application and distribute only one file (EXE or DLL)


7 Years
Discussion Span
Last Post by alexb119

I don't know of a way to embed the .txt file itself inside the executable like a resource, but you could set up a struct or table of strings or something inside the program instead of a text file.

Alternatively, if you have an IDE like MS Visual Studio, you could create a setup project which includes the text file, the executable, and any other files you want and have it all installed in the appropriate directory.

Hope this helps.



It's easy:
- keep your .txt file in the /res folder
- in your project .rc file add the following:
IDS_WHATEVER_TXT RCDATA DISCARDABLE "res\\Myfile.TXT" (mind the double quotes)
- in the resource.h file:
#define IDS_WHATEVER_TXT whateverPleasesYou
the above will embed the .txt file in your executable.
at run time extract and interpret the contents.


Edited by alexb119: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.