S
Sowen
Hi, all
I am wondering how to write bits by using ofstream?
I have finished a huffman tree, but how can I write the bits to the file in
order to gain compression?
for example, 'A' returns a code '1101', what I should write? 13? no, I don't
think so
Just now I tried my own thinking, 'cause 4 bits can represent a hex, so I
write 'D' instead of '13' in the above example,
but, I can only gain compression if there are a few unique characters, like
"abc abc abc" or "aaaaaaaaaaaaaaa"
If there are many different characters, my thinking cannot "compress" the
file.
I have worked on this for couple of days, still can't figure out what I
should write and how I can write the bits to the file in order to compress
file.
Please help, thank you very much!
--
Best Regards!
Sowen Cheung
http://com.angGoGo.com
http://www.angGoGo.com
http://biz.angGoGo.com
I am wondering how to write bits by using ofstream?
I have finished a huffman tree, but how can I write the bits to the file in
order to gain compression?
for example, 'A' returns a code '1101', what I should write? 13? no, I don't
think so
Just now I tried my own thinking, 'cause 4 bits can represent a hex, so I
write 'D' instead of '13' in the above example,
but, I can only gain compression if there are a few unique characters, like
"abc abc abc" or "aaaaaaaaaaaaaaa"
If there are many different characters, my thinking cannot "compress" the
file.
I have worked on this for couple of days, still can't figure out what I
should write and how I can write the bits to the file in order to compress
file.
Please help, thank you very much!
--
Best Regards!
Sowen Cheung
http://com.angGoGo.com
http://www.angGoGo.com
http://biz.angGoGo.com