Thread: RLE Encoding/Decoding using simple C concept..plz help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    > but the program is running perfectly..
    Just because it runs without crashing and produces an output file is not a sign of perfection.

    You're not addressing the issues raised in my previous post.

    Given 1/122/3
    You need to find a way of making sure it decodes as
    1/122/3
    and not as
    1/122/3
    This is what Cactus_Hugger was talking about.

    It might be easier if you always wrote the length out as 3 digits, say
    1/0122/003
    If you know the length is always 3 digits, it makes it easier to deal with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    plz tell me something..

    say for ex : 1\125

    all thses are characters.we are to print 1 125 tyms.how can we conver characters 125 into integar..??

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by garv84 View Post
    plz tell me something..

    say for ex : 1\125

    all thses are characters.we are to print 1 125 tyms.how can we conver characters 125 into integar..??
    If you write the compressor properly then you don't have to!

    Everyone always teaches RLE compression by giving examples with text, and shows the compressed version as if it were text. Such examples always contain lots of repeated bytes too.
    However that's not the reality of how anybody who knows what they're doing implements it.

    You are supposed to accept binary data, and write out binary data. Every byte value between 0 and 255 should be able to be compressed from the input file, and later restored after decompression of hte compressed file. This in turn basically means that your compressed file becomes a binary format as well.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. a simple question. plz help
    By monashhros3 in forum C Programming
    Replies: 1
    Last Post: 03-28-2008, 01:40 PM
  2. plz help me with simple string comparison.
    By MegaManZZ in forum C++ Programming
    Replies: 11
    Last Post: 02-18-2008, 01:11 PM
  3. Matrix Multiplication with simple syntax! plz help.
    By codebox in forum C Programming
    Replies: 6
    Last Post: 11-05-2004, 09:03 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM