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)

Thanks.

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.

Jeff

If your exe and dll can remain together, why not txt file. Maybe you can distribute them together as a zip file.
Or you can use a free installer for distributing "everything" as a single "exe"
Like http://www.createinstall.com/index.html
Vinayak

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.

alex

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.