shqiptari88 0 Newbie Poster

Hi,

I need to program to compress/decompress txt files using Huffman algotrithm

I have writen it, and it works good for files that have less charachters than the buffer size, but it doesnt work for files with greater number of characters.

My problem is to interface compression buffer with decompression buffer.

So if the number of bytes written by the compression (which contains the 1 and 0 to go through the tree), is different from the number of bytes the decompression reads it does not work.
Example, if the buffer of the compression writes 200, I need the buffer of decompression to read exactly 200 bytes.

If i set the size of decompression to read 200, somewhere the compression will write 200 and other times less or more than 200.

Can you suggest anything how to keep track of the numbers of byte written by compression each time and transmit it to decompression part?