I Am Working On A Project Related To Data Compression Using Huffmann Algorithm In C Language..........i Have Generated The Huffmann Codes Using Huffmann Tree.........but The Project Is Yet To Be Completed As I Don`t Know How To Store The Codes In Bits.............i Have Just Learned C.
We Have To Submit The Project By 28 Th Feb............so Expecting A Quick Response...............

Usually you will have yourself a little function that takes a specific number of bits (let's say just one bit at a time for each branch in the tree).

The function will modify a static "bits" variable (say, one byte) by shifting in the new bit, and incrementing another static "count" variable that keeps track of the number of bits stored in the byte. Once the counter hits eight (for one byte == eight bits), the byte is written to the output stream, and the "bits" and "count" variables are reset to zero.

You will also need a "final" function that flushes bits remaining when your huffman stream doesn't produce a multiple of eight bits (since the last byte won't be completely filled, but it must still be output).

Hope this helps.

Thanks For Your Solution ................i`ll Soon Try To Implement That And Will Report You And Again Ask For Guidance If Required.............well What Is Profession Nwdays And Your Country..............

Glad you found a possible solution.
If you're going to stick around could you do us a favor?
Could you stop Capitalizing at random some ( most ) of the words? It makes your post hard to read.
And we could live without the ..................... as well, it doesn't do anything to enhanced your
writing, but the contrary is true.

well every person has its own style to communicate..............thats what this is................

Comments
If you want to brush off a good percentage of people who might post answers, and a high percentage of the better answers, then continue to ignore sound advice in this fashion.

>well every person has its own style to communicate
>..............thats what this is................
And every person has the right to ignore styles they find difficult to follow. Get used to it.

This article has been dead for over six months. Start a new discussion instead.