Janman Janman - 1 year ago 95
C++ Question

File compression with C++

I want to make my own text file compression program. I don't know much about C++ programming, but I have learned all the basics and writing/reading a file.
I have searched on google a lot about compression, and saw many different kind of methods to compress a file like LZW and Huffman. The problem is that most of them don't have a source code, or they have a very complicated one.
I want to ask if you know any good webpages where I can learn and make a compression program myself?

I will let this topic be open for a little longer, since I plan to study this the next few days, and if I have any questions, I'll ask them here.

Answer Source

Most of the algorithms are pretty complex. But they all have in common that they are taking data that is repeating and only store it once and have a system of knowing how to uncompress them (putting the repeated segments back in place)

Here is a simple example you can try to implement.

We have this data file




Here we have chars that repeat and two lines that repeat. So you could start with finding a way to reduce the filesize.

Here's a simple compression algorithm.




So we have 4 of X, one of F, 3 of G etc.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download