-
Hi,
I was wondering if it's possible to compress/decompress files without using dll's or controls?
It seems that all the code out there for compression through VB utiltizes dll's or controls. Is there a reason for this? Is it not possible to do compression through code or api using VB? Would that be something that can only be done in C++?
Any help would be appreciated..
Dan
-
I believe there are programs on http://www.planet-source-code.com that are able to zip files without having to use a control or activex dll. Try searching for "Winzip" or "Compression".
-
There's a few reasons why C++ is actually easier to write compression code in (not speed):
1. Pointers - find data sections easily
2. Much better memory handling
3. Binary file handing
And yes, it is faster. Take a look at ZLibDLL (do a search on AV) for what is pretty much a standard. Also, if there is any code for BZip2, use that, because it is technically more advanced and creates smaller files.
-
compression is easy
fooled you. actually, compressing is easy like i said, good compression is not. this is not the zip format, but it's easy to do:
Look for a sequence of characters that occurs two or more times, and is at least two characters long.
In the previous sentance, there are the following:
lo: LOok LOng
or: fOR OR mORe
two : TWO TWO
characters : twice (Remember to include spaces if possible)
Now, lets subsitute a ! for lo ? for or, a > for two and a < for characters.
!ok f? a sequence of<that occurs>? m?e times, and is at least><!ng.
Original sentance: 102 characters
Compressed: 67 characters.
That's 35% compression. Plus, I only looked for obvious sequences, not every other letter or every third. Unfortuently, you need to include the susbstitioun code as well. It may look like this:
FORMAT: REPLACEMENT SYMBOL - LENGTH OF TEXT (to avoid CRLF) - TEXT. when header wears out, text begins.
!2lo?2or>5 two <10characters!ok f? a sequence of<that occurs>? m?e times, and is at least><!ng.
While it's not as impressive now, its still damn good for one sentance.
not practical for this example, but the most common are:
" the " chr$(13)+chr$(10) " a " " i " " an ", all minus the quotes of course.
Thats compression 101
-
[quote]There's a few reasons why C++ is actually easier to write compression code in (not speed):
1. Pointers - find data sections easily
2. Much better memory handling
3. Binary file handing
[quote]
Okay.. with point 1 i have to agree.. VB has no real pointer operation.
point 2.. Learn to program }:)
point 3.. Open "Bla.bin" for BINARY as #1
VB has Binary file handling too (Since gwBasic ;)
-
Er...I know that. What I meant was, binary files in C++ are a lot easier, because you can read/write things faster, easier, and more efficiently. Plus you can cheat and since you have control over the alignment of your data structures you can massage them into different objects, for example turn a struct into an int* :).