Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User sumit_ramani's Avatar
    Join Date
    Sep 2006
    Posts
    10
    Hii Folks,

    I am working on Huffman Encoding for compression.In order to reduce the size of files(effectively compress them) I need to replace each character by their coreesponding huffman code.So its highly likely that an 8 bit character by 2-3 bits.

    I was wondering if anybody of you could help in writing bit by bit on a file.

    Regards,
    Sumit

  2. #2
    Nokia Developer Moderator petrib's Avatar
    Join Date
    Mar 2003
    Posts
    9,412
    Don't write bit-by-bit to a file, but fill a memory buffer bit-by-bit and once you have enough bits to fill at least a byte (or whatever size chunk makes sense; 256 bytes, 512 bytes, 1024 bytes, whatever), write the byte(s) to a file.

    Of course, the last/final bits, if it is not an even byte, by chance, needs to be padded to full 8 bits. And you, of course need to know (store) what's such padding so that you don't mistakenly handle such padding as actual data/content that you need to process.

Similar Threads

  1. [moved] Theme Studio Error
    By TalJ in forum Themes/Carbide.ui
    Replies: 2
    Last Post: 2009-09-06, 03:39
  2. File corrupted - with signed sis
    By annehj in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2007-12-10, 13:44
  3. File reading & writing help, wav file redaing help
    By shubhamlahoti in forum Mobile Java General
    Replies: 6
    Last Post: 2007-06-27, 09:07
  4. Replies: 3
    Last Post: 2006-05-02, 20:12
  5. could not find thread.mbg and thread.rsg
    By deercrane in forum Symbian C++
    Replies: 3
    Last Post: 2006-04-18, 09:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved