Mail Archives: djgpp/1998/10/26/05:30:24
Leif writes:
> My program uses a file on disk to load graphics and other misc
> data... I was wondering how I could INCLUDE all that data into
> my program so that it will not need any other files to be on disk.
Allegro provides two methods for doing this.
1) You can use the dat2s utility to convert an Allegro-format
datafile (which can contain any other custom object formats that
you like) into an assembler source file (.s), which you can then
compile and link with your program to make all these objects
directly available. Take a look at the setup program for an example
of this method in use.
2) You can use the exedat utility to attach a file (which can be an
Allegro datafile or any other raw data that you like) onto the end
of your executable. This can then be read back using the Allegro
packfile functions: the special filename "#" represents the entire
appended data, and a name in the form "#objectname" represents a
specific object from an appended datafile (so you can embedd lots
of objects into a datafile, append that archive in one step, and
then read the objects back individually). See the ex34 example
program for a demonstration of using exedat.
If you aren't using Allegro, obviously neither of these methods
will be so directly useful to you, but they are both very easy
to implement, and you are welcome to borrow any bits of these
tools if they would be useful for you.
Shawn Hargreaves.
- Raw text -