Re: Embedding Graphics.

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

>    I've been musing about this, as well. It might be nice if someone would
>write a routine that would convert a list of bytes into text format that
>would be easy to place into programs by including the file - something
along
>the lines of what UUE does.


Well, some months ago (6/8) I wrote Install Kit. The way it works:

1.- Code your program. and declare a constant (integer) called OFFSET.

2.- Make a function that loads on DATA the data that is stored from OFFSET
to EOF of the first filename in a call to command_line(). Example:
        function load_data(integer offset)
                integer fn
                sequence data
                object aux
                -- Get filename
                aux = command_line()
                aux = aux[1]
                -- Open file for binary read
                fn = open(aux,"rb")
                -- Start reading from given offset
                aux = seek(fn,offset)
                -- Lets fill data
                data = ""
                aux = getc(fn)
                while aux != -1 do
                        data = data & aux
                end while
                -- Voila! return data.
                return data
        end function

3.- Put at the very end of your code abort(0) followed by a blank line.

4.- Bind your program and take note of it length.

5.- Go back to your code and set OFFSET value to the length of your binded
program.

6.- Go to step 3 until the value in OFFSET equals the length of the .exe
file.

7.- Make a copy /b of your .exe file(s) and the file you want to embed.

Note: As you can see you can store as many files as you want, as long as you
write a suitable routine for reading them. You could, for instance, put a
"table of contents" at OFFSET and then "jump" to the disered file (that's
what I did on IK).

I hope this helps on the subject.

Regards,

    Daniel Berstein.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu