resources

T

Thorsten Kiefer

Hi,
how do i bake resources into an executable ?
One way would be to convert binary files into headerfiles like that :

pic1.h:
char *pic1 = {23,45,254,.....};

But is there another way ?

Regards
Thorsten
 
A

Alf P. Steinbach

* Thorsten Kiefer:
Hi,
how do i bake resources into an executable ?
One way would be to convert binary files into headerfiles like that :

pic1.h:
char *pic1 = {23,45,254,.....};

But is there another way ?

Not in standard C++. But the OS might help. On the Mac each file
traditionally had two forks: code and resources. In Windows executable
files have direct support for resources (both code and resources in the
same fork), but also forks, or as they're in Windows, "streams".

So put this question to an OS-specific group.
 
J

Jim Langston

Thorsten Kiefer said:
Hi,
how do i bake resources into an executable ?
One way would be to convert binary files into headerfiles like that :

pic1.h:
char *pic1 = {23,45,254,.....};

But is there another way ?

One trick that may, or may not, work for you is to write your resources
after the end of the executable. I.E. Compile your program, than tack on to
the end. If you do do this usually the very last 4 (or sizeof int) bytes
are the size of the data written, so you open the executable for reading,
jump to the end, back up 4 bytes, read the number of bytes in the resources,
then offsent to it.

I'm not saying it's a good way, just one way that's done.

Then you have Microsoft who has a resource file that you can put into the
executable.

Myself, I just provide data files along with the executable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top