Best way to store a .zip within code

BlitzPlus Forums/BlitzPlus Programming/Best way to store a .zip within code

Pineapple(Posted 2007) [#1]
I'm a lazy bum with no way to upload files (don't ask why) and a guy did this someplace else without sharing his method. (http://www.blitzbasic.com/Community/posts.php?topic=38938#433551) So I ask, what is the best way to make a B+ file that writes a .zip file which is stored within the code, like a Data statement? Hopefully I don't sound too idiotic.


Abrexxes(Posted 2007) [#2]
http://www.sodaware.net/dev/blitz/libs/blitz.zipapi/

I think that should be what you are looking for.


Andres(Posted 2007) [#3]
Ive done something like that by adding (just appending) a file to the exe and after that i read the exe from a certain seek position (size of the exe, without the included file) and "extracted" the file. It worked, but its possible that it could crash the application or something.

exe% = OpenFile(exe)
SeekFile(exe%, FileSize(exe))
zip% = ReadFile(zip)
for i = 1 to FileSize(zip)
    WriteByte(exe%, ReadByte(zip%))
next



Pineapple(Posted 2007) [#4]
No, I don't mean that, I mean doing something where I just post the code, you run it, and whoop-dee-doo now you have the zip file.


EDIT dang this post has a short limit.

Here it is with a much smaller zip:



Hm... why is the new file 100 bytes bigger than the original?


Pineapple(Posted 2007) [#5]
sorry for post =/

can someone delete this please


Pineapple(Posted 2007) [#6]
sorry for the post =/

could someone please delete this


Abrexxes(Posted 2007) [#7]
If you use the WriteLine command, blitz add to every line the lenght (of the line) in 2 bytes.

For example "HELLO" will take 7 bytes and not 5. It you read the line with ReadLine you must remove the first 2 bytes. So i recommand to use "Bytes" for this.

bye


Pineapple(Posted 2007) [#8]
What difference does it make? Writing with it to a bb file shouldn't cause any issues, should it?