0

I have an encoded 0 and 1 Output file(Output.bin) for Huffman and Codes for every appeared ASCII(Codes.bin). My Input file size is 3kb and my Output encoded file size is 12Kb(Output.bin) which is larger. I'm asking the way to store Output to get less space.I have used Dynamic Huffman.

Abhishek
  • 1
  • 1
  • What is the type of the file you're trying to compress? Text? An image? Something else? – Welbog Aug 01 '17 at 14:29
  • 1
    You probably stored chars '0' and '1' and not into bits... – Jean-Baptiste Yunès Aug 01 '17 at 14:37
  • 2
    Possible duplicate of [How to write single bits to a file in C](https://stackoverflow.com/questions/27589460/how-to-write-single-bits-to-a-file-in-c) – Jean-Baptiste Yunès Aug 01 '17 at 14:38
  • @Welbog Its Text – Abhishek Aug 01 '17 at 17:33
  • How to store Bits in File??? – Abhishek Aug 01 '17 at 17:33
  • Well, you just store them?? Do you understand how computer memory works? What is BYTE and BIT? Then for example if your output is 313 bits long, you need 40 bytes of memory to store it (with last 7 bits unused), and then you simply write those 40 bytes into file (of length of 40 bytes, unless you store there also some headers/etc). Actually you may want to store also some header with the information about data, that only 313 bits are relevant, not full 40*8=320 bits in the file, etc... up to you, to define the data structure, and then to interpret the memory/file content accordingly. – Ped7g Aug 01 '17 at 18:39

0 Answers0