transfer encoding

the master
06-03-2005, 03:54 PM
hi, ive noticed that when you load a file such as an exe into a string and use string formatting functions (left() right() etc) it currupts the file.

when certain web apps like IE or normal servers send a file like an exe it gets encoded to what i think is "transfer encoding". this encoding allows you to use string formatting functions without currupting the file.

ok, now the question.. how do i encode it to this thing?

RoofRabbit
06-03-2005, 06:29 PM
An EXE file is a binary executable (a program in other words). You simply can't load it as a string. "Transfer" programs like a FTP client transfer the file in binary mode, not text mode. I can't imagine a case where string functions could be usefully applied to an executable anyways. Although exe's may or may not contain text within, you really can't change it other than with a hex editor and even then, you can't change the origional string length.

Can I ask what you are trying to do with what exe file?

the master
06-03-2005, 06:41 PM
well, its not all exe's. the plan is to stick 2 files, like say 2 pictures into 1 file. i can easily do this but when it comes to splitting them up i can split them without using left() and right() or some complicated other stuff. when i get file sent from things like internet explorer they are encoded so i can use left() and right() to split the headers from the file itself and it wont currupt anything.

the plan is to make this nice and simple, the "complicated other stuff" is as i said, "complicated" and i wanna use that as the last option

Cyroxis
06-04-2005, 12:17 AM
Why not use something like a .cab or .zip file

RoofRabbit
06-04-2005, 03:31 AM
I agree. I use zip files a lot since they can optionaly contain the desired directory paths as well as the files. It can also be made to a self extracting exe file for people who don't happen to have winzip installed. Using zip files will also compress the final file for you as well.

If you want to create your own custom file, it wouldn't be that hard to do. If I had several files I wanted in a single file (not cab or zip), I'd probably start with a header saying how many files were contained in it, a list of the filenames along with their sizes, then sequencial blocks of data containing the files. Unless you have a special need, zip files would be the best though.

the master
06-04-2005, 05:06 AM
well, the files wont all be exctracted to the same folder. the idea is to have certain apps on my computer stuck into this one file so its easy to install them, an app will load the file and copy bits from it to certain places and register dlls and things as it goes and setup all the reg info too. makes things a lot easier for me.


other than using left() and right() i can only think of the complicated way that involves simply adding all the files together then logging which byte each one starts at. doesnt sound too hard now but these type of things usually are ;)

Cyroxis
06-04-2005, 11:08 PM
Ok, well first off I would suggest packaging and deployment wizard. If that does not suit your needs. You should use some sort of archive file. There are ones out there that allow you to build your own hierarchical file system within one file. I think that would be exactly what you want but I can't remember the name of the one I am thinking of right now. Hope this helps

RoofRabbit
06-04-2005, 11:15 PM
I agree, maybe use the packaging and deployment wizard.
You should also note zip files may contain files with many different paths. They don't have to all be extracted to a single directory.

the master
06-05-2005, 04:37 AM
hmm, sounds like a good idea. i think something similar to the P&D wiz but not actually that because that isnt all that good. ive got another setup maker that i think lets you have loads of control over what happens so ill have to give that a go ;)

wakjah
06-05-2005, 05:05 AM
Inno Setup (http://www.jrsoftware.org/isinfo.php) is excellent

the master
06-05-2005, 12:09 PM
Inno Setup (http://www.jrsoftware.org/isinfo.php) is excellent

yeah, thats the one i was thinking of :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum