|
-
Oct 18th, 2000, 06:07 PM
#1
Thread Starter
Frenzied Member
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
-
Oct 18th, 2000, 06:12 PM
#2
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".
-
Oct 18th, 2000, 08:20 PM
#3
Monday Morning Lunatic
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.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 18th, 2000, 09:02 PM
#4
Addicted Member
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
Brian
Programming: VB5 Pro (SP3) - QBasic 1.1,4.5
Internet: HTML 4, CSS, JavaScript
Visit AltInt.com!
-
Oct 19th, 2000, 01:50 AM
#5
-
Oct 19th, 2000, 12:18 PM
#6
Monday Morning Lunatic
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* .
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|