Re: Big file ...

new topic     » goto parent     » topic index » view thread      » older message » newer message

> >Assume, I have written an .ex program with some picturefiles, sounds
> >etc.
> >How can I put all that stuff into ONE .exe file?
>
> If you are thinking of .WAV and .BMP files. (Or other files, other than
> .e files), then... You can't. Well, it could be possible, but difficult
> and would take up 3+ times the HD space. You should just PKzip them all
> together when you want to send it.

WRONG!!! you can! The proof if my "Install Kit" (available at my
homepage".
It's not very easy to achieve, but not that dificult...
Here's the trick:

1.- Take note of the length of each fils you want to attach to your
EXE file.

2.- Copy all these files into just one, with "copy /b" (take note of
the order the files are stored in this new file).

3.- Inside your Euphoria file (.ex) code the routines that access
the file(s) that will be attached, in the following  way:
        -Create a global variable called "AppLen" of type atom.
        -To access the first file contained in the attachment use a code
        like:
                fn = open("myexe.exe","rb")
                seek(fn, AppLen + 1)
                ... read information...
                close(fn)

           Where "myexe.exe" is your application name.

        -To access the second file in the attachment:
                fn = open("myexe.exe","rb")
                seek(fn,AppLen + File1 + 1)
                ......
                close(fn)

          Where File1 if the length of the first file in the attachment (I
           told you to write it down!)

        - So you access *any* file in the attachment with something like:
                seek(fn,AppLen + SumFile + 1)

                Where SumFile is the sum of the lengths of the previous files
                stored in the attachment.

4.- Put in the very last line of your code the statement "abort(0)"
and then a blank line.

5.- Now create your EXE file with BIND, and take note of the size of
the executable.

6.- Go back to your .EX file and initialize the global variable
AppLen with the length you noted above.

7.- BIND again your application and check that the exe file hasn't
changed. If it has changed go back to point 5.

8.- Using "copy /b" bind your .EXE file with the attachment file you
created.

9.- Enjoy it!!!

Note: The "abort(0)" is required so Euphoria stops scanning your code
before reaching the attached binary information.


Regards,
  Daniel Berstein
  danielberstein at usa.net
  http://www.geocities.com/SiliconValley/Heights/9316

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu